carbon-components-svelte/types/Button/Button.d.ts
Eric Liu f4c940d5ee
Make UI Shell HeaderAction panel transition configurable (#419)
* fix(ui-shell): remove fly transition from hamburger menu

* feat(header-action): make panel transition configurable

* chore: rebuild types, docs

* docs(ui-shell): document transition prop in Header app switcher example
2020-11-26 17:14:07 -08:00

112 lines
2.7 KiB
TypeScript

/// <reference types="svelte" />
import { ButtonSkeletonProps } from "./ButtonSkeleton";
export interface ButtonProps
extends ButtonSkeletonProps,
svelte.JSX.HTMLAttributes<HTMLElementTagNameMap["button"]>,
svelte.JSX.HTMLAttributes<HTMLElementTagNameMap["a"]>,
svelte.JSX.HTMLAttributes<HTMLElementTagNameMap["div"]> {
/**
* Specify the kind of button
* @default "primary"
*/
kind?: "primary" | "secondary" | "tertiary" | "ghost" | "danger" | "danger-tertiary" | "danger-ghost";
/**
* Specify the size of button
* @default "default"
*/
size?: "default" | "field" | "small";
/**
* Set to `true` for the icon-only variant
* @default false
*/
hasIconOnly?: boolean;
/**
* Specify the icon from `carbon-icons-svelte` to render
*/
icon?: typeof import("carbon-icons-svelte").CarbonIcon;
/**
* Specify the ARIA label for the button icon
*/
iconDescription?: string;
/**
* Set the alignment of the tooltip relative to the icon
* `hasIconOnly` must be set to `true`
*/
tooltipAlignment?: "start" | "center" | "end";
/**
* Set the position of the tooltip relative to the icon
*/
tooltipPosition?: "top" | "right" | "bottom" | "left";
/**
* Set to `true` to render a custom HTML element
* Props are destructured as `props` in the default slot (e.g., <Button let:props><div {...props}>...</div></Button>)
* @default false
*/
as?: boolean;
/**
* Set to `true` to display the skeleton state
* @default false
*/
skeleton?: boolean;
/**
* Set to `true` to disable the button
* @default false
*/
disabled?: boolean;
/**
* Set the `href` to use an anchor link
*/
href?: string;
/**
* Specify the tabindex
* @default "0"
*/
tabindex?: string;
/**
* Specify the `type` attribute for the button element
* @default "button"
*/
type?: string;
/**
* Obtain a reference to the HTML element
* @default null
*/
ref?: null | HTMLAnchorElement | HTMLButtonElement;
}
export default class Button {
$$prop_def: ButtonProps;
$$slot_def: {
default: {
props: {
role: "button";
type?: string;
tabindex: any;
disabled: boolean;
href?: string;
class: string;
[key: string]: any;
};
};
};
$on(eventname: "click", cb: (event: WindowEventMap["click"]) => void): () => void;
$on(eventname: "mouseover", cb: (event: WindowEventMap["mouseover"]) => void): () => void;
$on(eventname: "mouseenter", cb: (event: WindowEventMap["mouseenter"]) => void): () => void;
$on(eventname: "mouseleave", cb: (event: WindowEventMap["mouseleave"]) => void): () => void;
$on(eventname: string, cb: (event: Event) => void): () => void;
}