Installation
Section titled “Installation”- Package
@bigbang/ui- Import
import { YearPicker } from '@bigbang/ui';- Source
- YearPicker.tsx
- Storybook
- YearPicker · Playground
YearPicker is in the @bigbang/ui package. The value is a number (the year).
import { YearPicker } from '@bigbang/ui';
<YearPicker label="Fiscal year" name="year" min={2020} max={2026} value={value} onValueChange={setValue} />;labelRequired- Description
- The visible label of the field.
- Type
string
description- Description
- Help text under the field, linked with
aria-describedby. - Type
ReactNode
error- Description
- When set, the field is marked invalid and the message is read with the trigger.
- Type
string
invalid- Description
- Marks the field invalid without a message.
- Type
boolean- Default
false
required- Description
- A year is required; the label gets
*. - Type
boolean- Default
false
value- Description
- Controlled value. Pass it with
onValueChange. - Type
number | null
defaultValue- Description
- Initial value when the field is uncontrolled.
- Type
number
onValueChange- Description
- Called with the chosen year.
- Type
(value: number) => void
min- Description
- Earliest year that can be chosen.
- Type
number
max- Description
- Latest year that can be chosen.
- Type
number
placeholder- Description
- Trigger text while no year is chosen. Without it,
ui.year-picker.placeholder("Yıl seçin" or "Choose a year"). - Type
string
size- Description
- Trigger height: 32, 36 and 40 px, as Select.
- Type
'sm' | 'md' | 'lg'- Default
'md'
readOnly- Description
- Shows the value but does not open the picker.
- Type
boolean- Default
false
disabled- Description
- Disables the field.
- Type
boolean- Default
false
name- Description
- Field name; a hidden input submits the year as
YYYY. - Type
string
className- Description
- Added to the root element; use it for layout only.
- Type
string
Data attributes
Section titled “Data attributes”data-component="year-picker": on the root.data-part:trigger,popup,panel,header,title,grid.data-selectedanddata-currenton a cell.