@konstructio/ui
Version:
A set of reusable and customizable React components built for konstruct.io
27 lines (26 loc) • 960 B
TypeScript
import { VariantProps } from 'class-variance-authority';
import { ButtonHTMLAttributes, Ref } from 'react';
import { Theme } from '../../../domain/theme';
import { buttonVariants } from './Button.variants';
/**
* Props for the Button component.
*
* @example
* ```tsx
* <Button variant="primary">Click me</Button>
* <Button variant="secondary" disabled>Disabled</Button>
* <Button variant="danger" shape="circle"><TrashIcon /></Button>
* ```
*/
export interface Props extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'disabled'>, VariantProps<typeof buttonVariants> {
/** Ref to the underlying button element */
ref?: Ref<HTMLButtonElement>;
/** Merge props onto child element instead of rendering a button */
asChild?: boolean;
/** Whether the button is disabled */
disabled?: boolean;
/** Theme override for this component */
theme?: Theme;
}
/** @deprecated Use Props instead */
export type ButtonProps = Props;