@hypothesis/frontend-shared
Version:
Shared components, styles and utilities for Hypothesis projects
36 lines (35 loc) • 1.69 kB
TypeScript
/**
* @typedef {import('../../types').IconComponent} IconComponent
*
* @typedef {import('../../types').PresentationalProps} CommonProps
* @typedef {import('./ButtonBase').ButtonCommonProps} ButtonCommonProps
* @typedef {import('./ButtonBase').HTMLButtonAttributes} HTMLButtonAttributes
*
* @typedef ButtonProps
* @prop {'sm'|'md'|'lg'} [size='md'] - Adjusts padding on button
* @prop {'primary'|'secondary'} [variant='secondary']
* @prop {IconComponent} [icon] - Optional icon to display at left
* of button label text. Will be sized proportional to local font size.
*/
/**
* Render a button with a label (`children`) and optional icon
*
* @param {CommonProps & ButtonCommonProps & ButtonProps & HTMLButtonAttributes} props
*/
export default function Button({ children, classes, elementRef, expanded, pressed, title, icon: Icon, size, variant, ...htmlAttributes }: CommonProps & ButtonCommonProps & ButtonProps & HTMLButtonAttributes): import("preact").JSX.Element;
export type IconComponent = import('../../types').IconComponent;
export type CommonProps = import('../../types').PresentationalProps;
export type ButtonCommonProps = import('./ButtonBase').ButtonCommonProps;
export type HTMLButtonAttributes = import('./ButtonBase').HTMLButtonAttributes;
export type ButtonProps = {
/**
* - Adjusts padding on button
*/
size?: "sm" | "md" | "lg" | undefined;
variant?: "primary" | "secondary" | undefined;
/**
* - Optional icon to display at left
* of button label text. Will be sized proportional to local font size.
*/
icon?: import("preact").FunctionComponent<import("preact").JSX.SVGAttributes<SVGSVGElement>> | undefined;
};