@buun_group/brutalist-ui
Version:
A brutalist-styled component library
95 lines (94 loc) • 2.65 kB
TypeScript
/**
* @module Radio
* @description A radio button component system with group management for single-selection scenarios. Features brutalist styling with customizable sizes and validation states.
*/
import React, { InputHTMLAttributes } from 'react';
/**
* Props for the RadioGroup component
*/
export interface RadioGroupProps {
/**
* Name attribute for the radio group (required for form handling)
*/
name: string;
/**
* Currently selected value (controlled mode)
*/
value?: string;
/**
* Default selected value (uncontrolled mode)
*/
defaultValue?: string;
/**
* Callback function called when the selection changes
*/
onChange?: (value: string) => void;
/**
* Radio buttons to render within the group
*/
children: React.ReactNode;
/**
* Layout direction for the radio buttons
* @default 'vertical'
*/
direction?: 'horizontal' | 'vertical';
/**
* Size variant for all radio buttons in the group
* @default 'md'
*/
size?: 'sm' | 'md' | 'lg';
/**
* Whether all radio buttons in the group are disabled
* @default false
*/
disabled?: boolean;
/**
* Whether the group is in an error state
* @default false
*/
error?: boolean;
/**
* Whether to apply brutalist shadow effect to radio buttons
* @default true
*/
brutalistShadow?: boolean;
/**
* Additional CSS classes to apply to the group container
*/
className?: string;
/**
* Additional inline styles to apply to the group container
*/
style?: React.CSSProperties;
}
export declare const RadioGroup: React.FC<RadioGroupProps>;
/**
* Props for the Radio component
*/
export interface RadioProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'type' | 'size' | 'onChange'> {
/**
* The value of this radio button
*/
value: string;
/**
* Label text or element to display next to the radio button
*/
label?: React.ReactNode;
/**
* Size variant for this specific radio button (overrides group size)
*/
size?: 'sm' | 'md' | 'lg';
/**
* Whether this specific radio button is disabled (overrides group disabled)
*/
disabled?: boolean;
/**
* Whether this specific radio button is in error state (overrides group error)
*/
error?: boolean;
/**
* Whether to apply brutalist shadow effect (overrides group setting)
*/
brutalistShadow?: boolean;
}
export declare const Radio: React.ForwardRefExoticComponent<RadioProps & React.RefAttributes<HTMLInputElement>>;