@asphalt-react/button
Version:
Button
97 lines (93 loc) • 2.18 kB
TypeScript
type Override<T, U> = Omit<U, keyof T> & T
interface ButtonProps {
/**
* React node for button's caption
*/
children: React.ReactNode
/**
* Renders a primary variant
*/
primary?: boolean
/**
* Renders a secondary variant
*/
secondary?: boolean
/**
* Renders a tertiary variant
*/
tertiary?: boolean
/**
* Renders a nude variant
*/
nude?: boolean
/**
* Renders brand intent
*/
brand?: boolean
/**
* Renders danger intent
*/
danger?: boolean
/**
* Renders system intent
*/
system?: boolean
/**
* Renders a link button
*/
link?: boolean
/**
* Link element to render. Accepts an HTML element or a React component.
*/
as?: React.ElementType
/**
* Accepts props & attributes for the link element.
*/
asProps?: object
/**
* Renders an icon button
*/
icon?: boolean
/**
* Shrinks the size of the Button keeping the size of the contents intact. Useful for use-cases with space-constraints.
*/
compact?: boolean
/**
* Qualifier is an icon or a word that enhances the caption. Button prepends the qualifier by default. Accepts SVG for icons. Checkout `@asphalt-react/iconpack` for SVG wrapped React components.
*
* > ⚠️ Do not use `qualifier` to render an icon button, use `icon` prop instead
*/
qualifier?: React.ReactElement | string
/**
* Appends qualifier to the caption
*/
qualifierEnd?: boolean
/**
* Controls size of button. Possible values are "xs", "s", "m", "l" for extra small, small, medium & large respectively
*/
size?: "xs" | "s" | "m" | "l"
/**
* Stretches Button to take it's container width
*/
stretch?: boolean
/**
* Adapts to let other buttons stick to its start
*/
stickStart?: boolean
/**
* Adapts to let other buttons stick to its end
*/
stickEnd?: boolean
/**
* Enhances the style of the supporting button.
*/
stick?: boolean
/**
* Adds underline in link Button
*/
underline?: boolean
}
declare function Button(
props: Override<ButtonProps, React.ButtonHTMLAttributes<HTMLButtonElement>>
): JSX.Element
export { Button, type ButtonProps };