#Button
import Button from "@poodle/ui/Button";
#Variant
The button can change to a defined style via props variant
.
Built in styles are default
, fill
, outline
. If you do not set variant, the button will use the variant default
as default.
The button also find the variant style in theme.Button.variants
object.
#Default
The default button is text button.
Typically, use it with unimportant actions.
#Filled
Filled buttons normally are primary buttons for your app.
#Outline
Outline buttons have more interactive than text buttons, but they are less important than a primary button.
#Button with icon
Add icon to the button using endIcon
and startIcon
prop.
#Sizes
Change button size via prop sizeStyle
.
Default button sizes are s
, m
, l
. If you do not set size, the button will use the size m
as default.
#Render as link
Button will change to <a>
tag if prop href
is set.
If the button disabled
prop set to true, the button will render as <button>
tag. <a>
tag does not support disable.
#Theming
Please check theming component document here.
export type ButtonStyleKeys =| "root"| "content"| "icon"| "startIcon"| "endIcon"export interface ButtonThemeConfigextends StandardThemeConfig<ButtonStyleKeys, ButtonProps> {}
#Props
#Local Props
Name | Type | Description |
---|---|---|
children | React.ReactNode | |
className | string | Class apply to root element. |
colorStyle | "default" \| "primary" \| "negative" \| "positive" \| "warn" \| string | Change button color. Built-in options are "default" | "primary" | "negative" | "positive" | "warn". Default is "default". |
contentProps | BoxProps | Custom props for content element |
endIcon | React.ReactNode | Add icon to end of the button. |
iconProps | BoxProps | Custom props for icon element |
sizeStyle | "s" \| "m" \| "l" \| string | Change button size. Built-in options are "s" | "m" | "l". Default is "m". |
startIcon | React.ReactNode | Add icon to start of the button. |
theme | ThemeConfig | |
themeExtend | ThemeConfig | |
variant | "default" \| "outline" \| "fill" \| string | Change button variant. Built-in options are "default" | "outline" | "fill". Default is "default". |
#Full Props
export interface ButtonPropsextends Omit<React.AnchorHTMLAttributes<HTMLAnchorElement> &React.ButtonHTMLAttributes<HTMLButtonElement>,keyof BoxProps>,BoxProps,LocalButtonProps {}