This package contains a radio group component that can be used to select one option from a list of options.
This library is based on Radix Ui.
Change Log
To use this package, you must install the @pikas-ui/styles package.
You can install this package using npm, yarn, or pnpm.
npm install @pikas-ui/radio-group
yarn add @pikas-ui/radio-group
pnpm add @pikas-ui/radio-group
This component is used to create a radio group.
Eu est labore ea laborum laborum mollit non minim eu commodo.
import { RadioGroup } from '@pikas-ui/radio-group';
const Example: React.FC = () => {
return (
<RadioGroup
label="Radio Group label"
description="Eu est labore ea laborum laborum mollit non minim eu commodo."
required
id="Radio Group"
data={[
{
label: 'Radio Group item 1',
value: 'radio-group-item-1',
},
{
label: 'Radio Group item 2',
value: 'radio-group-item-2',
},
{
label: 'Radio Group item 3',
value: 'radio-group-item-3',
disabled: true,
},
]}
/>
);
};
Prop | Description | Type | Default |
---|---|---|---|
data | The data of the radio group | RadioGroupItem[] | required |
id | The id of the radio group | string | - |
label | The label of the radio group | ReactNode or string | - |
textError | The error text of the radio group | string | - |
fontSize | The font size of the radio group | PikasFontSize | em-base |
className | The class name of the radio group | string | - |
description | The description of the radio group | string | - |
css | The css of the radio group | RadioGroupCSS | - |
required | The required of the radio group | boolean | - |
info | The info of the radio group | ReactNode | - |
defaultValue | The default value of the radio group | string | - |
value | The value of the radio group | string | - |
onChange | The onChange of the radio group | (value: string) => Promise<void> or void | - |
disabled | The disabled of the radio group | boolean | - |
name | The name of the radio group | string | - |
orientation | The orientation of the radio group | RadioGroupOrientation | "vertical" |
dir | The direction of the radio group | RadioGroupDirection | "ltr" |
loop | The loop of the radio group | boolean | false |
This component is used to create a radio group with images.
Eu est labore ea laborum laborum mollit non minim eu commodo.
import { RadioGroupImage } from '@pikas-ui/radio-group';
const Example: React.FC = () => {
return (
<RadioGroupImage
label="Radio Group Image label"
description="Eu est labore ea laborum laborum mollit non minim eu commodo."
required
id="Radio Group Image"
data={[
{
label: 'Radio Group Image item 1',
value: 'Radio Group Image item 1',
image: 'https://picsum.photos/200/300',
},
{
label: 'Radio Group Image item 2',
value: 'Radio Group Image item 2',
image: 'https://picsum.photos/200/300',
},
{
label: 'Radio Group Image item 3',
value: 'Radio Group Image item 3',
image: 'https://picsum.photos/200/300',
disabled: true,
},
]}
/>
);
};
Prop | Description | Type | Default |
---|---|---|---|
data | The data of the radio group | RadioGroupImageItem[] | required |
id | The id of the radio group | string | - |
label | The label of the radio group | ReactNode or string | - |
textError | The error text of the radio group | string | - |
fontSize | The font size of the radio group | PikasFontSize | em-base |
className | The class name of the radio group | string | - |
description | The description of the radio group | string | - |
css | The css of the radio group | RadioGroupImageCSS | - |
required | The required of the radio group | boolean | - |
info | The info of the radio group | ReactNode | - |
defaultValue | The default value of the radio group | string | - |
value | The value of the radio group | string | - |
onChange | The onChange of the radio group | (value: string) => Promise<void> or void | - |
disabled | The disabled of the radio group | boolean | - |
name | The name of the radio group | string | - |
orientation | The orientation of the radio group | RadioGroupOrientation | "vertical" |
dir | The direction of the radio group | RadioGroupDirection | "ltr" |
loop | The loop of the radio group | boolean | false |
borderRadius | The border radius of the radio group | PikasRadius | "md" |
imageWidth | The image width of the radio group | number or string | 40 |
imageHeight | The image height of the radio group | number or string | 40 |
This documentation can be edited on GitHub here