its-just-ui
Version:
ITS Just UI - The easiest and best React UI component library. Modern, accessible, and customizable components built with TypeScript and Tailwind CSS. Simple to use, production-ready components for building beautiful user interfaces with ease.
105 lines (103 loc) • 3.44 kB
TypeScript
import { default as React } from 'react';
export type SegmentedVariant = 'solid' | 'outline' | 'ghost' | 'filled' | 'minimal' | 'underline';
export type SegmentedSize = 'sm' | 'md' | 'lg';
export type SegmentedDirection = 'horizontal' | 'vertical';
export type SegmentedTransition = 'smooth' | 'bouncy' | 'swift' | 'elastic' | 'instant' | 'fade';
export interface SegmentedOption {
label: string;
value: string;
icon?: React.ReactNode;
disabled?: boolean;
}
export interface SegmentedProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange'> {
value?: string;
defaultValue?: string;
onChange?: (value: string) => void;
options: SegmentedOption[];
disabled?: boolean;
readOnly?: boolean;
fullWidth?: boolean;
rounded?: boolean;
stretch?: boolean;
variant?: SegmentedVariant;
size?: SegmentedSize;
direction?: SegmentedDirection;
transition?: SegmentedTransition;
borderWidth?: string;
borderColor?: string;
borderRadius?: string;
borderStyle?: string;
fontSize?: string;
fontWeight?: string;
fontFamily?: string;
textColor?: string;
backgroundColor?: string;
hoverColor?: string;
activeColor?: string;
selectedTextColor?: string;
indicatorColor?: string;
indicatorTransition?: string;
indicatorBorderRadius?: string;
padding?: string;
gap?: string;
margin?: string;
focusRingColor?: string;
focusBorderColor?: string;
hoverShadow?: string;
animateIndicator?: boolean;
flexWrap?: boolean;
renderItem?: (option: SegmentedOption, isSelected: boolean, isDisabled: boolean) => React.ReactNode;
'aria-label'?: string;
'aria-labelledby'?: string;
}
interface SegmentedContextValue {
value?: string;
onChange: (value: string) => void;
disabled?: boolean;
readOnly?: boolean;
variant: SegmentedVariant;
size: SegmentedSize;
direction: SegmentedDirection;
transition: SegmentedTransition;
options: SegmentedOption[];
borderWidth?: string;
borderColor?: string;
borderRadius?: string;
borderStyle?: string;
fontSize?: string;
fontWeight?: string;
fontFamily?: string;
textColor?: string;
backgroundColor?: string;
hoverColor?: string;
activeColor?: string;
selectedTextColor?: string;
indicatorColor?: string;
indicatorTransition?: string;
indicatorBorderRadius?: string;
padding?: string;
gap?: string;
focusRingColor?: string;
focusBorderColor?: string;
hoverShadow?: string;
animateIndicator?: boolean;
renderItem?: (option: SegmentedOption, isSelected: boolean, isDisabled: boolean) => React.ReactNode;
indicatorStyle: React.CSSProperties;
updateIndicator: (element: HTMLElement | null) => void;
}
export declare const useSegmented: () => SegmentedContextValue;
interface SegmentedItemProps {
option: SegmentedOption;
}
declare const SegmentedItem: React.FC<SegmentedItemProps>;
declare const SegmentedIndicator: {
(): import("react/jsx-runtime").JSX.Element | null;
displayName: string;
};
interface SegmentedComponent extends React.ForwardRefExoticComponent<SegmentedProps & React.RefAttributes<HTMLDivElement>> {
Item: typeof SegmentedItem;
Indicator: typeof SegmentedIndicator;
}
declare const SegmentedCompound: SegmentedComponent;
export { SegmentedCompound as Segmented };
export default SegmentedCompound;