@eccenca/gui-elements
Version:
GUI elements based on other libraries, usable in React application, written in Typescript.
35 lines (34 loc) • 1.39 kB
TypeScript
import React from "react";
import { ButtonProps } from "../Button/Button";
import { ValidIconName } from "./canonicalIconNames";
import { TestIconProps } from "./TestIcon";
import { TestableComponent } from "../interfaces";
interface ExtendedButtonProps extends Omit<ButtonProps, "name" | "icon" | "rightIcon" | "text" | "minimal" | "tooltip">, TestableComponent {
/**
* Canonical icon name, or an array of strings.
* In case of the array the first valid icon name is used.
*/
name: ValidIconName | string[] | React.ReactElement<TestIconProps>;
/**
* Button text, will be displayed as tooltip.
*/
text?: string;
/**
* If `text` should be set as HTML `title` attribute instead of attaching it as tooltip.
* If true then `tooltipProps` is ignored.
*/
tooltipAsTitle?: boolean;
/**
* Description for icon as accessibility fallback.
* If not set then `text` is used.
*/
description?: string;
/**
* Button is displayed with minimal styles (no borders, no background color).
*/
minimal?: boolean;
}
export type IconButtonProps = ExtendedButtonProps;
/** A button with an icon instead of text. */
export declare const IconButton: ({ className, name, text, tooltipProps, description, tooltipAsTitle, minimal, ...restProps }: IconButtonProps) => React.JSX.Element;
export default IconButton;