tharikida-ui
Version:
A modern, lightweight React UI component library with built-in theming, accessibility, and full TypeScript support. Create beautiful, responsive, and customizable web apps faster with ready-to-use components for any project.
48 lines (47 loc) • 1.92 kB
TypeScript
import React from "react";
/**
* `RadioButton` is a custom radio/checkbox component supporting controlled/uncontrolled usage, theming, and custom styles.
*
* @param {object} props - The properties to customize the `RadioButton` component.
* @param {boolean} [props.checked] - Controls the checked state (controlled component). If not provided, the radio manages its own state.
* @param {(event: React.ChangeEvent<HTMLInputElement>) => void} [props.onChange] - Called when the radio is selected. Receives the change event.
* @param {React.CSSProperties} [props.styles] - Custom styles for the outer label.
* @param {string} [props.className] - Additional className for the outer label.
* @param {boolean} [props.disabled] - Disables the radio if true.
* @param {string} [props.name] - Name for the radio group (required for grouping radios).
* @param {string} [props.value] - Value for the radio input.
*
* @returns {JSX.Element} A styled radio button component.
*/
export interface RadioButtonProps {
/**
* Controls the checked state (controlled component). If not provided, the radio manages its own state.
*/
checked?: boolean;
/**
* Called when the radio is selected. Receives the change event.
*/
onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
/**
* Custom styles for the outer label.
*/
styles?: React.CSSProperties;
/**
* Additional className for the outer label.
*/
className?: string;
/**
* Disables the radio if true.
*/
disabled?: boolean;
/**
* Name for the radio group (required for grouping radios)
*/
name?: string;
/**
* Value for the radio input
*/
value?: string;
}
declare const RadioButton: ({ checked, onChange, styles, className, disabled, name, value, }: RadioButtonProps) => import("react/jsx-runtime").JSX.Element;
export default RadioButton;