analytica-frontend-lib
Version:
Repositório público dos componentes utilizados nas plataformas da Analytica Ensino
86 lines (83 loc) • 2.69 kB
TypeScript
import * as react from 'react';
import { ReactNode, InputHTMLAttributes } from 'react';
/**
* Radio size variants
*/
type RadioSize = 'small' | 'medium' | 'large' | 'extraLarge';
/**
* Radio visual state
*/
type RadioState = 'default' | 'hovered' | 'focused' | 'invalid' | 'disabled';
/**
* Radio component props interface
*/
type RadioProps = {
/** Label text to display next to the radio */
label?: ReactNode;
/** Size variant of the radio */
size?: RadioSize;
/** Visual state of the radio */
state?: RadioState;
/** Error message to display */
errorMessage?: string;
/** Helper text to display */
helperText?: string;
/** Additional CSS classes */
className?: string;
/** Label CSS classes */
labelClassName?: string;
/** Radio group name */
name?: string;
/** Radio value */
value?: string;
/** Default checked state for uncontrolled radios */
defaultChecked?: boolean;
} & Omit<InputHTMLAttributes<HTMLInputElement>, 'size' | 'type' | 'defaultChecked'>;
/**
* Radio component for Analytica Ensino platforms
*
* A radio button component with essential states, sizes and themes.
* Uses the Analytica Ensino Design System colors from styles.css with automatic
* light/dark mode support. Includes Text component integration for consistent typography.
*
* @example
* ```tsx
* // Basic radio
* <Radio name="option" value="1" label="Option 1" />
*
* // Small size
* <Radio size="small" name="option" value="2" label="Small option" />
*
* // Invalid state
* <Radio state="invalid" name="option" value="3" label="Required field" />
*
* // Disabled state
* <Radio disabled name="option" value="4" label="Disabled option" />
*
* // Default checked (uncontrolled)
* <Radio defaultChecked name="option" value="5" label="Initially checked" />
* ```
*/
declare const Radio: react.ForwardRefExoticComponent<{
/** Label text to display next to the radio */
label?: ReactNode;
/** Size variant of the radio */
size?: RadioSize;
/** Visual state of the radio */
state?: RadioState;
/** Error message to display */
errorMessage?: string;
/** Helper text to display */
helperText?: string;
/** Additional CSS classes */
className?: string;
/** Label CSS classes */
labelClassName?: string;
/** Radio group name */
name?: string;
/** Radio value */
value?: string;
/** Default checked state for uncontrolled radios */
defaultChecked?: boolean;
} & Omit<InputHTMLAttributes<HTMLInputElement>, "size" | "defaultChecked" | "type"> & react.RefAttributes<HTMLInputElement>>;
export { type RadioProps, Radio as default };