Usage

Choose a size

This type is used by Select

tsx
import { Select, Text, VStack, signal } from 'kuito';

const SIZES = [
  { value: 's', label: 'Small' },
  { value: 'm', label: 'Medium' },
  { value: 'l', label: 'Large' },
];

export default function Size() {
  const size = signal<string | undefined>(undefined);

  return (
    <VStack gap={8} padding={16}>
      <Select label="Size" options={SIZES} value={size} placeholder="Choose a size" height={44} />
      <Text>{size.value ?? 'No size yet'}</Text>
    </VStack>
  );
}

Type declaration

ts
export type SelectProps = {
  /** In the order the menu lists them; each value names one option. */
  options: SelectOption[];
  /**
   * The chosen option's value; none while it names no option. Two-way when
   * given a signal: the select writes it as the user picks.
   */
  value?: string;
  /** What it shows while no option is chosen. */
  placeholder?: string;
  disabled?: boolean;
  /** The value of the option the user picked. */
  onChange?: (value: string) => void;
};

Members 5

NameTypeRequiredDescription
optionsSelectOption[]YesIn the order the menu lists them; each value names one option.
valuestringNoThe chosen option's value; none while it names no option. Two-way when given a signal: the select writes it as the user picks.
placeholderstringNoWhat it shows while no option is chosen.
disabledbooleanNo—
onChange(value: string) => voidNoThe value of the option the user picked.
onChange — method signatures

Signatures

ts
(value: string): void

Parameters

NameTypeRequiredDescription
valuestringYes—

Returns

void

Generated from the public TypeScript declarations: signatures, props and defaults come from the checked source, descriptions from its JSDoc. No defaults are invented.