Checkbox
The Checkbox
component provides a standard checkbox input element with an optional label.
Example Usage
import React, { useState } from 'react';
import { Checkbox } from '@ginger-society/ginger-ui';
export const Example = () => {
const [checked, setChecked] = useState(false);
const handleCheckboxChange = (newChecked) => {
setChecked(newChecked);
};
return (
<Checkbox
label="Accept Terms and Conditions"
checked={checked}
onChange={handleCheckboxChange}
/>
);
};
Props
Checkbox
Prop | Type | Description |
---|---|---|
label | string | Optional. Label for the checkbox. |
checked | boolean | Required. Indicates whether the checkbox is checked. |
onChange | (checked: boolean) => void | Optional. Callback function called when the checkbox state changes. |