weavify
Version:
````markdown # **Weavify - Reusable UI Components**
47 lines (46 loc) • 1.92 kB
TypeScript
/**
* CustomCheckboxGroup Component
*
* A reusable checkbox group component that allows users to select multiple options.
* It supports custom alignment, label display, and required fields for form validation.
*
* Author: Anish Kumar
* Email: anishbishnoi127@gmail.com
*
* @param {string} label - The label for the checkbox group.
* @param {string} name - The name attribute for the checkbox group, used to group the options.
* @param {string[]} value - The array of currently selected values.
* @param {function} onChange - Callback function to handle changes when an option is selected/deselected.
* @param {Array} options - Array of options to display in the checkbox group. Each option has a 'value' and 'label'.
* @param {'row' | 'column'} alignment - Defines the layout of the checkboxes, either 'row' or 'column'.
* @param {boolean} [required=false] - If true, the checkbox group is marked as required.
* @param {boolean} [isLabelRequired=false] - If true, the label will be marked as required.
* @param {string} id - Unique identifier for the checkbox group.
* @param {string} [wrapperStyle] - Custom styling for the wrapper around the checkbox group.
* @param {string} [checkboxStyle] - Custom styling for each checkbox.
*/
interface Option {
value: string;
label: string;
name: string;
}
interface CheckboxGroupProps {
label: string;
name: string;
value: string[];
onChange: (event: React.ChangeEvent<HTMLInputElement>) => void;
options: Option[];
alignment: 'row' | 'column';
required?: boolean;
isLabelRequired?: boolean;
id: string;
wrapperStyle?: string;
checkboxStyle?: string;
containerStyle?: string;
levelStyle?: string;
levelOneStyle?: string;
levelTwoStyle?: string;
levelThreeStyle?: string;
}
declare const _default: import("react").NamedExoticComponent<CheckboxGroupProps>;
export default _default;