Radio
note: props name di Radio harus uniq, jika ada 2 component radio di satu halaman pastikan name nya berbeda
Base
Typescript
import { Radio } from 'alurkerja-ui'
export const RadioPage = () => {
return(
<Radio
name="radio"
listOption={[
{ label: 'radio1', key: 1 },
{ label: 'radio2', key: 2 },
]}
/>
)
}
DefaultValue
Typescript
import { Radio } from 'alurkerja-ui'
export const RadioPage = () => {
return(
<Radio
name="radio"
listOption={[
{ label: 'radio1', key: 1 },
{ label: 'radio2', key: 2 },
]}
defaultValue={2}
/>
)
}
Disabled
Typescript
import { Radio } from 'alurkerja-ui'
export const RadioPage = () => {
return(
<Radio
name="radio"
listOption={[
{ label: 'radio1', key: 1 },
{ label: 'radio2', key: 2 },
]}
defaultValue={2}
disabled
/>
)
}
OnChange
Typescript
import { Radio } from 'alurkerja-ui'
export const RadioPage = () => {
return(
<Radio
name="radio"
listOption={[
{ label: 'radio1', key: 1 },
{ label: 'radio2', key: 2 },
]}
onChange={(value) => value !== undefined && alert(value)}
/>
)
}