Skip to main content

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

PropTypeDescription
labelstringOptional. Label for the checkbox.
checkedbooleanRequired. Indicates whether the checkbox is checked.
onChange(checked: boolean) => voidOptional. Callback function called when the checkbox state changes.