@tolokoban/ui
Version:
React components with theme
68 lines • 2.27 kB
TypeScript
import * as React from "react";
import { CommonProps } from "../../theme/styles/common";
import { Children, OpaqueColorName } from "../../types";
import { GenericIconProps } from "../icons/generic";
export type ViewButtonProps = {
/**
* The look of a button depends on its variant:
*
* * __filled__ (default): button ith background.
* * __elevated__: with a shadow below.
* * __outline__: no background but a surrounding border.
* * __text__: text only, no background, no border.
*
* Default to `"filled"`.
*/
variant?: "elevated" | "filled" | "outlined" | "text";
/**
* This property is here for backward compatibility.
* It is an alias for `children`. But if both props are
* defined, `children` takes precedence.
*/
label?: Children;
/** Content of the button. Most often a text, but can be anything. */
children?: Children;
/**
* Click handler.
*
* If you set a string, the button will be turned into
* a link to an URL. But the style will remain the same.
*/
onClick?: string | ((this: void) => void);
/**
* If the button is a link (onClick is a string),
* then `target` is used to open in a new tab.
*/
target?: string;
/**
* Default to `true`.
*
* If set to `false`, the button cannot get the focus and cannot be clicked.
*/
enabled?: boolean;
/**
* Main color of the button.
* It will be the background, unless we use `variant="text"`
* or `variant="outline"`.
*/
color?: OpaqueColorName;
/**
* Icon to display to the left.
*/
icon?: React.FC<GenericIconProps>;
/**
* Icon to display to the right.
*/
iconRight?: React.FC<GenericIconProps>;
/**
* If `true`, an icon will rotate and the button will be disabled.
*/
waiting?: boolean;
/**
* Thickness of the button's border.
*/
thickness?: string | number;
} & CommonProps;
export declare function ViewButton(partialProps: ViewButtonProps): import("react/jsx-runtime").JSX.Element;
export declare function makeCustomButton(defaultProps: Partial<ViewButtonProps>): (props: ViewButtonProps) => JSX.Element;
//# sourceMappingURL=Button.d.ts.map