Select
A dropdown whose options are SelectOption children; no native select is rendered.
import { Select, SelectOption } from '@iffday/ui';Example
Options are SelectOption children. Select reads their values and labels and hands them to Base UI, so the page has no native <select>. The list opens 5px below the trigger instead of covering it; the selected option has a check, and disabled ones are faded.
import { useT } from '@iffday/i18n';
import { Field, Select, SelectOption } from '@iffday/ui';
import { useState } from 'react';
export default function Example() {
const t = useT();
const [language, setLanguage] = useState('');
return (
<div style={{ width: 'min(100%, 280px)' }}>
<Field label={t('film.media.posterLanguage')}>
<Select value={language} onValueChange={setLanguage}>
<SelectOption value="">{t('film.media.allLanguages')}</SelectOption>
<SelectOption value="ko">ko</SelectOption>
<SelectOption value="en">en</SelectOption>
<SelectOption value="zh-hans">zh-hans</SelectOption>
<SelectOption value="ja" disabled>
ja
</SelectOption>
</Select>
</Field>
</div>
);
}Usage
- Values are strings. Numbers work too, but
onValueChangereceives a string; convert it back where needed. - An empty string can stand for All or None: the poster language filter and No rating both do this.
- With a handful of options that readers should see at once, consider
Tabsor a row of buttons.
Props
| Prop | Type | Default |
|---|---|---|
children* | ReactNode | |
value | string | number | |
defaultValue | string | number | |
onValueChange | (value: string) => void | |
disabled | boolean | |
required | boolean | |
name | string | |
className | '' |
Other props go to Omit<HTMLAttributes<HTMLButtonElement>, 'children' | 'defaultValue' | 'onChange'>.
- src/pages/cms-festivals.tsx15
- src/pages/cms.tsx13
- src/pages/personal.tsx8
- src/pages/editorial.tsx5
- src/pages/programme.tsx5
- src/pages/social.tsx5
- src/pages/cms-translations.tsx3
- src/pages/film-images.tsx3
- src/pages/planner-settings.tsx3
- src/pages/catalog-drafts.tsx2
- src/components.tsx1
- src/film-media.tsx1
- src/pages/account-settings.tsx1
- src/pages/archive-tools.tsx1
- src/pages/cms-addresses.tsx1
- src/pages/festival-directory.tsx1
- src/pages/film-entry.tsx1
- src/pages/schedule.tsx1
- src/pages/sticker-board.tsx1
SelectOption
packages/ui/src/controls.tsx:56Declarative option data consumed by Select. No native select is rendered.
| Prop | Type | Default |
|---|---|---|
value | string | number | |
children* | ReactNode | |
disabled | boolean |
- src/pages/cms.tsx28
- src/pages/cms-festivals.tsx25
- src/pages/personal.tsx15
- src/pages/programme.tsx15
- src/pages/editorial.tsx12
- src/pages/social.tsx10
- src/pages/planner-settings.tsx7
- src/pages/film-images.tsx5
- src/pages/cms-translations.tsx4
- src/pages/account-settings.tsx3
- src/pages/catalog-drafts.tsx3
- src/pages/sticker-board.tsx3
- src/components.tsx2
- src/film-media.tsx2
- src/pages/archive-tools.tsx2
- src/pages/film-entry.tsx2
- src/pages/schedule.tsx2
- src/pages/cms-addresses.tsx1
- src/pages/festival-directory.tsx1