-
Notifications
You must be signed in to change notification settings - Fork 33
Expand file tree
/
Copy pathdocs.button.jsx
More file actions
212 lines (196 loc) · 6.87 KB
/
Copy pathdocs.button.jsx
File metadata and controls
212 lines (196 loc) · 6.87 KB
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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
import { useRef } from "react";
import Code from "~/components/Code";
import Heading from "~/components/Heading";
import Link from "~/components/Link";
import Content from "~/components/docs/Content";
import EditOnGithub from "~/components/docs/EditOnGithub";
import Header from "~/components/docs/Header";
import TableOfContents from "~/components/docs/TableOfContents";
import metaData from "~/data/meta";
const { titleSuffix } = metaData;
export const meta = () => [
{ title: `Button ${titleSuffix}` },
{
name: "description",
content: "Buttons are using the native <button> tag, without .classes for the default style.",
},
];
export default function Button() {
const syntaxRef = useRef();
const variantsRef = useRef();
const formButtonsRef = useRef();
const disabledRef = useRef();
const roleButtonRef = useRef();
const usageWithGroupRef = useRef();
return (
<>
{/* Header */}
<Header
title="Button"
description={
<>
Buttons are using the native <Code display="inline">{`<button>`}</Code> tag, without{" "}
<code>.classes</code>. for the default style.
</>
}
/>
{/* Table of content */}
<TableOfContents
data={[
{
anchor: "",
title: "Syntax",
ref: syntaxRef,
},
{
anchor: "variants",
title: "Variants",
ref: variantsRef,
},
{
anchor: "form-buttons",
title: "Form buttons",
ref: formButtonsRef,
},
{
anchor: "disabled",
title: "Disabled",
ref: disabledRef,
},
{
anchor: "role-button",
title: "Role button",
ref: roleButtonRef,
},
{
anchor: "usage-with-group",
title: "Usage with group",
ref: usageWithGroupRef,
},
]}
/>
{/* Content */}
<Content>
<section aria-label="Overview" ref={syntaxRef}>
<article aria-label="Button example" className="component">
<button>Button</button>
<Code as="footer" className="small">{`<button>Button</button>`}</Code>
</article>
</section>
<section ref={variantsRef}>
<Heading level={2} anchor="variants">
Variants
</Heading>
<p>
Buttons come with <code>.secondary</code> and <code>.contrast</code> styles (not
available in the <Link to="/docs/classless">class-less version</Link>).
</p>
<article aria-label="Button colors example" className="component">
<div className="grid">
<button className="secondary">Secondary</button>
<button className="contrast">Contrast</button>
</div>
<Code as="footer">{`<button class="secondary">Secondary</button>
<button class="contrast">Contrast</button>
`}</Code>
</article>
<p>
They also come with a classic outline style (not available in the{" "}
<Link to="/docs/classless">class-less version</Link>).
</p>
<article aria-label="Buttons outline example" className="component">
<div className="grid">
<button className="outline">Primary</button>
<button className="outline secondary">Secondary</button>
<button className="outline contrast">Contrast</button>
</div>
<Code as="footer">{`<button class="outline">Primary</button>
<button class="outline secondary">Secondary</button>
<button class="outline contrast">Contrast</button>`}</Code>
</article>
</section>
<section ref={formButtonsRef}>
<Heading level={2} anchor="form-buttons">
Form buttons
</Heading>
<p>
<code>type="submit"</code> and <code>type="button"</code> inputs are also displayed as
buttons. All form buttons are <code>width: 100%;</code> by default, to match with the
other form elements.
</p>
<article aria-label="Input buttons example" className="component">
<input type="submit" />
<input type="button" value="Input" />
<Code as="footer">{`<input type="submit">
<input type="button" value="Input">`}</Code>
</article>
<p>Reset inputs have the secondary style by default.</p>
<article aria-label="Reset input example" className="component">
<input type="reset" />
<Code as="footer" className="small">{`<input type="reset">`}</Code>
</article>
</section>
<section ref={disabledRef}>
<Heading level={2} anchor="disabled">
Disabled
</Heading>
<p>Buttons come with a disabled style.</p>
<article aria-label="Disabled buttons example" className="component">
<div className="grid">
<button disabled>Disabled</button>
<button className="secondary" disabled>
Disabled
</button>
<button className="contrast" disabled>
Disabled
</button>
</div>
<Code as="footer">{`<button disabled>Disabled</button>
<button class="secondary" disabled>Disabled</button>
<button class="contrast" disabled>Disabled</button>`}</Code>
</article>
</section>
<section ref={roleButtonRef}>
<Heading level={2} anchor="role-button">
Role button
</Heading>
<p>
Clickable elements with <code>role="button"</code> are rendered as buttons.
</p>
<article aria-label="Role button example" className="component">
<div role="button" tabIndex="0">
Div as button
</div>
<Code
as="footer"
className="small"
>{`<div role="button" tabindex="0">Div as a button</div>`}</Code>
</article>
</section>
<section ref={usageWithGroupRef}>
<Heading level={2} anchor="usage-with-group">
Usage with group
</Heading>
<p>
You can use <code>role="group"</code> with buttons. See{" "}
<Link to="/docs/group">Group</Link>.
</p>
<article className="component" aria-label="Group example">
<div role="group">
<button>Button</button>
<button>Button</button>
<button>Button</button>
</div>
<Code as="footer">{`<div role="group">
<button>Button</button>
<button>Button</button>
<button>Button</button>
</div>`}</Code>
</article>
</section>
{/* Edit on GitHub */}
<EditOnGithub file="docs.button.jsx" />
</Content>
</>
);
}