@buun_group/brutalist-ui
Version:
A brutalist-styled component library
49 lines (48 loc) • 1.43 kB
TypeScript
/**
* @module Toggle
* @description A button component that can be toggled between pressed and unpressed states. Supports both controlled and uncontrolled usage patterns with accessibility features.
*/
import React, { ButtonHTMLAttributes, CSSProperties } from 'react';
/**
* Props for the Toggle component
*/
export interface ToggleProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'type'> {
/**
* Visual style variant of the toggle button
* @default 'default'
*/
variant?: 'default' | 'brutal' | 'outline';
/**
* Size of the toggle button
* @default 'md'
*/
size?: 'sm' | 'md' | 'lg';
/**
* Controlled pressed state of the toggle
*/
pressed?: boolean;
/**
* Default pressed state for uncontrolled usage
* @default false
*/
defaultPressed?: boolean;
/**
* Callback function triggered when the pressed state changes
*/
onPressedChange?: (pressed: boolean) => void;
/**
* Whether to apply the brutalist shadow effect
* @default true
*/
brutalistShadow?: boolean;
/**
* Render as a child component (span) instead of button
* @default false
*/
asChild?: boolean;
/**
* Custom styles to apply to the toggle
*/
style?: CSSProperties;
}
export declare const Toggle: React.ForwardRefExoticComponent<ToggleProps & React.RefAttributes<HTMLButtonElement>>;