-
Notifications
You must be signed in to change notification settings - Fork 427
/
Copy pathbutton.d.ts
163 lines (161 loc) · 5 KB
/
button.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
declare module '@salesforce/design-system-react/components/button' {
import React from 'react';
type Props = {
/**
* **Assistive text for accessibility.**
* This object is merged with the default props object on every render.
* * `icon`: Text that is visually hidden but read aloud by screenreaders to tell the user what the icon means. If the button has an icon and a visible label, you can omit the <code>assistiveText.icon</code> prop and use the <code>label</code> prop.
*/
assistiveText?: Partial<{
icon?: string;
}>;
/**
* Callback that passes in the DOM reference of the `<button>` DOM node within this component. Primary use is to allow `focus` to be called. You should still test if the node exists, since rendering is asynchronous. `buttonRef={(component) => { if(component) console.log(component); }}`
*/
buttonRef?: (v: any) => any;
/**
* CSS classes to be added to button.
*/
className?: any[] | Record<string, any> | string;
/**
* Disables the button and adds disabled styling.
*/
disabled?: boolean;
/**
* Associates an icon button with another element on the page by changes the color of the SVG. Please reference <a href="http://www.lightningdesignsystem.com/components/buttons/#hint">Lightning Design System Buttons > Hint</a>.
*/
hint?: boolean;
/**
* Name of the icon category. Visit <a href="http://www.lightningdesignsystem.com/resources/icons">Lightning Design System Icons</a> to reference icon categories.
*/
iconCategory?: 'action' | 'custom' | 'doctype' | 'standard' | 'utility';
/**
* CSS classes to be added to icon.
*/
iconClassName?: any[] | Record<string, any> | string;
/**
* Name of the icon. Visit <a href="http://www.lightningdesignsystem.com/resources/icons">Lightning Design System Icons</a> to reference icon names.
*/
iconName?: string;
/**
* Path to the icon. This will override any global icon settings.
*/
iconPath?: string;
/**
* If omitted, icon position is centered.
*/
iconPosition?: 'left' | 'right';
/**
* Determines the size of the icon.
*/
iconSize?: 'x-small' | 'small' | 'medium' | 'large';
/**
* For icon variants, please reference <a href="http://www.lightningdesignsystem.com/components/buttons/#icon">Lightning Design System Icons</a>.
*/
iconVariant?:
| 'bare'
| 'container'
| 'border'
| 'border-filled'
| 'brand'
| 'more'
| 'global-header';
/**
* Id string applied to button node.
*/
id?: string;
/**
* If true, button/icon is white. Meant for buttons or utility icons on dark backgrounds.
*/
inverse?: boolean;
/**
* Visible label on the button. If the button is an icon button with no label, you must use the <code>assistiveText.icon</code> prop.
*/
label?: string | React.ReactNode;
/**
* Triggered when focus is removed.
*/
onBlur?: (v: any) => any;
/**
* Triggered when the button is clicked.
*/
onClick?: (v: any) => any;
/**
* Triggered when component is focused.
*/
onFocus?: (v: any) => any;
/**
* Triggered when a key is pressed down
*/
onKeyDown?: (v: any) => any;
/**
* Triggered when a key is pressed and released
*/
onKeyPress?: (v: any) => any;
/**
* Triggered when a key is released
*/
onKeyUp?: (v: any) => any;
/**
* Triggered when a mouse button is pressed down
*/
onMouseDown?: (v: any) => any;
/**
* Triggered when a mouse arrow hovers
*/
onMouseEnter?: (v: any) => any;
/**
* Triggered when a mouse arrow no longer hovers
*/
onMouseLeave?: (v: any) => any;
/**
* Triggered when a mouse button is released
*/
onMouseUp?: (v: any) => any;
/**
* If true, button scales to 100% width on small form factors.
*/
responsive?: boolean;
/**
* Write <code>"-1"</code> if you don't want the user to tab to the button.
*/
tabIndex?: string;
/**
* Button type
*/
type?: 'reset' | 'submit' | 'button';
/**
* HTML title attribute
*/
title?: string;
/**
* [Deprecated] Tooltip on button. Button should be a child of `Tooltip` instead.
*/
tooltip?: React.ReactNode;
/**
* Different types of buttons
*/
variant?:
| 'base'
| 'link'
| 'neutral'
| 'brand'
| 'outline-brand'
| 'destructive'
| 'success'
| 'text-destructive'
| 'icon';
/**
* Custom styles to be passed to the component
*/
style?: Record<string, any>;
children?: React.ReactNode;
};
/**
* The Button component is the Lightning Design System Button component. The Button should be used for label buttons, icon buttons, or buttons that have both labels and icons.
* Either a <code>label</code> or <code>assistiveText.icon</code> is required; see the Prop Details table below. For buttons that maintain selected/unselected states, use the <a href="#/button-stateful">ButtonStateful</a> component.
* Although not listed in the prop table, all `aria-*` and `form*` props will be added to the `button` element if passed in.
*/
function Component(props: Props): JSX.Element;
export default Component;
}