Icon Button
When the action a button invoke is so clear that needs no words, just an icon.
Anatomy
import { IconButton } from "@lualtek/react-components";
export default () => {
return <IconButton icon="plus" aria-label="Action description" />;
};
API Reference
export type ButtonProps = {
/**
* Set the style of the component.
* When disabled the style is overwritten.
* @default 'primary'
*/
kind?: "primary" | "secondary" | "flat";
/**
* Set the size of the component.
* @default 'regular'
*/
dimension?: "regular" | "small" | "big";
/**
* Define the icon to use.
*/
icon?: IconProps["source"];
/**
* Set disabled state. The component is not interactive and grayed out.
*/
disabled?: boolean;
/**
* Set the loading state and show a spinner.
*/
busy?: boolean;
/**
* Callback function to be called when the component is clicked.
*/
onClick?: (event: MouseEvent<HTMLButtonElement | HTMLAnchorElement>) => void;
/**
* Set a sentiment color/status to convey meaning and important to the action
*/
sentiment?: "positive" | "warning" | "danger";
/**
* Pass the HTML attribute `type` to the component.
* If not specified, the type is always 'button' when rendered as `<button>.
* @default 'button'
*/
type?: "submit" | "reset" | "button";
/**
* Set the component to render as different element
* @default 'button'.
*/
as?: JSX.IntrinsicElements | React.ComponentType<unknown>;
};