Usage

Switch between day, week and month

This type is used by SegmentedControl

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

const VIEWS = [
  { value: 'day', label: 'Day' },
  { value: 'week', label: 'Week' },
  { value: 'month', label: 'Month' },
];

export default function Plan() {
  const view = signal('week');

  return (
    <VStack gap={8} padding={16}>
      <SegmentedControl label="View" options={VIEWS} value={view} height={32} />
      <Text>{view.value}</Text>
    </VStack>
  );
}

Type declaration

ts
export type SegmentedControlProps = {
  /** A segment each, in order; each value names one option. */
  options: SelectOption[];
  /**
   * The chosen segment's value; none selected while it names no option.
   * Two-way when given a signal: the control writes it as the user picks.
   */
  value?: string;
  disabled?: boolean;
  /** The value of the segment the user picked. */
  onChange?: (value: string) => void;
};

Members 4

NameTypeRequiredDescription
optionsSelectOption[]YesA segment each, in order; each value names one option.
valuestringNoThe chosen segment's value; none selected while it names no option. Two-way when given a signal: the control writes it as the user picks.
disabledbooleanNo—
onChange(value: string) => voidNoThe value of the segment 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.