@arolariu/components
Version:
🎨 70+ beautiful, accessible React components built on Base UI. TypeScript-first, CSS Modules styling, tree-shakeable, SSR-ready. Perfect for modern web apps, design systems & rapid prototyping. Zero config, maximum flexibility! ⚡
87 lines • 2.77 kB
TypeScript
import { useRender } from "@base-ui/react/use-render";
import * as React from "react";
export type ButtonVariant = "default" | "destructive" | "outline" | "secondary" | "ghost" | "link";
export type ButtonSize = "default" | "sm" | "lg" | "icon";
/**
* Serializable button state exposed to Base UI render callbacks.
*/
export interface ButtonState extends Record<string, unknown> {
variant: ButtonVariant;
size: ButtonSize;
disabled: boolean;
}
interface ButtonVariantOptions {
variant?: ButtonVariant;
size?: ButtonSize;
className?: string;
}
/**
* Props for the shared button component.
*/
export interface ButtonProps extends Omit<React.ComponentPropsWithRef<"button">, "children" | "className" | "disabled"> {
/**
* Visual style variant.
* @default "default"
*/
variant?: ButtonVariant;
/**
* Size preset.
* @default "default"
*/
size?: ButtonSize;
/**
* Whether the button should ignore user interaction.
* @default false
*/
disabled?: boolean;
/**
* Additional CSS classes merged with the button styles.
* @default undefined
*/
className?: string;
/**
* Custom element or render callback used to replace the default `<button>`.
* @default undefined
*/
render?: useRender.RenderProp<ButtonState>;
/**
* Backward-compatible child-slot API.
* Converts the single child element to the `render` prop internally.
* @default false
*/
asChild?: boolean;
/**
* Button contents when `render` is not provided.
* @default undefined
*/
children?: React.ReactNode;
}
/**
* Builds the composed class list for the shared button component.
*/
declare function buttonVariants({ variant, size, className }?: Readonly<ButtonVariantOptions>): string;
/**
* A button component that triggers actions.
* Built with Base UI's canonical `useRender` + `mergeProps` composition pattern.
*
* @remarks
* Renders a native `<button>` by default. Use the `render` prop to compose the
* button styles and shared behavior with other elements or components. The
* deprecated `asChild` prop is still supported and internally converted to
* `render` for backward compatibility.
*
* @example
* ```tsx
* <Button variant="default" size="sm">Click me</Button>
* <Button render={<a href="/dashboard" />}>Go to dashboard</Button>
* ```
*
* @see {@link https://base-ui.com/react/components/button | Base UI Button}
*/
declare const Button: React.ForwardRefExoticComponent<Omit<ButtonProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
declare namespace Button {
type State = ButtonState;
type Props = ButtonProps;
}
export { Button, buttonVariants };
//# sourceMappingURL=button.d.ts.map