@heycar-uikit/core
Version:
The React UI library from HeyCar
50 lines (49 loc) • 1.17 kB
TypeScript
/// <reference types="react" />
import { HTMLAttributes } from 'react';
interface ButtonProps {
/**
* Label to be displayed on the button
*/
label: string;
/**
* Value assigned to the button
*/
value: string;
/**
* Icon to be displayed on the button, before the label
*/
icon?: React.ReactNode;
/**
* Disable the button
*/
isDisabled?: boolean;
/**
* ID for testing
*/
dataTestId?: string;
}
type Buttons = [ButtonProps, ButtonProps] | [ButtonProps, ButtonProps, ButtonProps];
interface ComponentProps {
/**
* An array of 2 or 3 buttons to display
*/
buttons: Buttons;
/**
* The id for testing
*/
dataTestId?: string;
/**
* Function to run on selecting a button
*/
onChange: (value: string) => void;
/**
* Current selected value
*/
currentValue?: string;
/**
* render buttons with wide left anf right padding
*/
wideView?: boolean;
}
type SegmentedButtonsProps = ComponentProps & HTMLAttributes<HTMLDivElement>;
export { ButtonProps, Buttons, ComponentProps, SegmentedButtonsProps };