Skip to content

Commit b3d5d2f

Browse files
committed
docs(design-guidelines): move "Switch vs. Checkbox" to Design Guidelines
1 parent 9435fcd commit b3d5d2f

File tree

6 files changed

+24
-18
lines changed

6 files changed

+24
-18
lines changed

guides.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export default [
1515
'src/design-guidelines/declutter/declutter.md',
1616
'src/design-guidelines/disabled-hidden/disabled-hidden.md',
1717
'src/design-guidelines/disabled-vs-readonly/disabled-vs-readonly.md',
18+
'src/design-guidelines/boolean/switch-vs-checkbox.md',
1819
],
1920
},
2021
] as Guide[];

src/components/checkbox/checkbox.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,10 @@ import { CheckboxTemplate } from './checkbox.template';
2929
* that have hierarchical relationships or when the group contains sub-items.
3030
* This state is used to indicate that that some, but not all, of the items in a group are selected.
3131
*
32-
* <limel-example-switch-vs-checkbox />
32+
* :::important
33+
* Checkboxes are sometimes used interchangeably with switches in user interfaces.
34+
* But there is an important difference between the two! Please read our guidelines about
35+
* [Switch vs. Checkbox](/#/DesignGuidelines/switch-vs-checkbox.md/).
3336
*
3437
* @exampleComponent limel-example-checkbox
3538
* @exampleComponent limel-example-checkbox-helper-text

src/components/switch/switch.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@ import {
2525
* The Switch component is widely used in user interfaces to enable users to
2626
* quickly and intuitively change binary settings.
2727
*
28-
* <limel-example-switch-vs-checkbox />
28+
* :::important
29+
* Checkboxes are sometimes used interchangeably with switches in user interfaces.
30+
* But there is an important difference between the two! Please read our guidelines about
31+
* [Switch vs. Checkbox](/#/DesignGuidelines/switch-vs-checkbox.md/).
2932
*
3033
* @exampleComponent limel-example-switch
3134
* @exampleComponent limel-example-switch-helper-text

src/components/switch/examples/switch-vs-checkbox.tsx renamed to src/design-guidelines/boolean/examples/switch-vs-checkbox.tsx

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,6 @@ import { Component, h } from '@stencil/core';
88
export class SwitchVsCheckboxExample {
99
public render() {
1010
return [
11-
<h3>Switch vs. Checkbox</h3>,
12-
<p>
13-
A checkbox and a switch both control binary options like On/Off
14-
or Enable/Disable. They are very similar in that sense, and many
15-
developers use them interchangeably.
16-
</p>,
17-
<p>
18-
However, there is a difference between these two components when
19-
it comes to usability and interaction design!
20-
</p>,
21-
<p>
22-
The rule of thumb is to use a <b>Switch</b>, whenever toggling
23-
the setting is instantly applied and does not required further
24-
explicit actions from the user. And use a <b>Checkbox</b> when
25-
the user has to confirm their choices for them to take effect.
26-
</p>,
2711
<div class="do-dont-container">
2812
<div class="do-not">
2913
<limel-header icon="brake_warning" heading="Don't" />
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Switch vs. Checkbox
2+
3+
A checkbox and a switch both control binary options like On/Off
4+
or Enable/Disable. They are very similar in that sense, and many
5+
developers use them interchangeably.
6+
7+
However, there is a difference between these two components when
8+
it comes to usability and interaction design!
9+
10+
The rule of thumb is to use a <b>Switch</b>, whenever toggling
11+
the setting is instantly applied and does not required further
12+
explicit actions from the user. And use a <b>Checkbox</b> when
13+
the user has to confirm their choices for them to take effect.
14+
15+
<limel-example-switch-vs-checkbox />

0 commit comments

Comments
 (0)