Radio Button - React
Radio Button
import { RadioInput } from '@idds/react';Contoh Penggunaan
Section titled “Contoh Penggunaan”Contoh 1 - Basic RadioInput
Section titled “Contoh 1 - Basic RadioInput”Selected:
Contoh 2 - Orientation Variants
Section titled “Contoh 2 - Orientation Variants”Contoh 3 - Disabled States
Section titled “Contoh 3 - Disabled States”| Name | Type | Default | Required | Description |
|---|---|---|---|---|
label | string | — | Yes | Label text yang ditampilkan di atas radio group. |
value | string | number | boolean | — | Yes | Nilai yang sedang dipilih (selected value). |
options | OptionItem[] | — | Yes | Array of options dengan format { label: string; value: string | number; }. |
onChange | (val: string | number) => void | — | Yes | Callback yang dipanggil ketika selection berubah. Menerima nilai yang baru dipilih. |
size? | 'sm' | 'md' | 'lg' | 'md' | No | Ukuran radio button. |
orientation? | 'vertical' | 'horizontal' | 'vertical' | No | Orientasi layout radio buttons: vertical (stacked) atau horizontal (inline). |
disabled? | boolean | false | No | Nonaktifkan seluruh radio group. |
required? | boolean | false | No | Tandai field sebagai required (menampilkan asterisk pada label). |
error? | boolean | false | No | Tampilkan state error (mengubah warna border dan helper text menjadi merah). |
helperText? | string | — | No | Text helper yang ditampilkan di bawah radio group. |
className? | string | — | No | ClassName tambahan untuk fieldset container. |