Verwendung

Choose a size

Dieser Typ wird verwendet von 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>
  );
}

Typdeklaration

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;
};

Mitglieder 5

NameTypErforderlichBeschreibung
optionsSelectOption[]JaIn the order the menu lists them; each value names one option.
valuestringNeinThe chosen option's value; none while it names no option. Two-way when given a signal: the select writes it as the user picks.
placeholderstringNeinWhat it shows while no option is chosen.
disabledbooleanNein—
onChange(value: string) => voidNeinThe value of the option the user picked.
onChange — Methodensignaturen

Signaturen

ts
(value: string): void

Parameter

NameTypErforderlichBeschreibung
valuestringJa—

Rückgabe

void

Generiert aus den öffentlichen TypeScript-Deklarationen: Signaturen, Props und Standardwerte stammen aus der geprüften Quelle, Beschreibungen aus deren JSDoc. Kein Standardwert ist erfunden.