Usage

Select a native control option.

tsx
// Select a native control option.
import { Select, Text, VStack, signal } from 'kuito';
import { assert, choose, render, screen, test } from 'kuito/tests';

function Sort() {
  const order = signal('new');

  return (
    <VStack>
      <Select
        label="Sort by"
        value={order}
        options={[
          { value: 'new', label: 'Newest' },
          { value: 'top', label: 'Most liked' },
        ]}
      />
      <Text>{order.value}</Text>
    </VStack>
  );
}

test('picking an option sets the order', async () => {
  await render(<Sort />);

  await choose(screen.getByRole('combobox', { name: 'Sort by' }), 'Most liked');

  assert.ok(screen.getByText('top'));
});

Signatures

ts
(view: TestView, choice: Date | string): Promise<void>

Parameters

NameTypeRequiredDescription
viewTestViewYes—
choicestring | DateYes—

Returns

Promise<void>

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