mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-18 11:36:36 +00:00
docs(breakpoint): update docs
This commit is contained in:
parent
cf384dec0a
commit
d03909e26c
2 changed files with 23 additions and 8 deletions
|
@ -1,21 +1,27 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {
|
import {
|
||||||
Breakpoint
|
Breakpoint, UnorderedList, ListItem
|
||||||
} from "carbon-components-svelte";
|
} from "carbon-components-svelte";
|
||||||
import Preview from "../../components/Preview.svelte";
|
import Preview from "../../components/Preview.svelte";
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
The [Carbon Design System grid implementation](https://carbondesignsystem.com/guidelines/2x-grid/implementation#responsive-options) defines five responsive breakpoints:
|
The [Carbon Design System grid implementation](https://carbondesignsystem.com/guidelines/2x-grid/implementation#responsive-options) defines five responsive breakpoints:
|
||||||
|
|
||||||
- Small (`sm`): less than 672px
|
<UnorderedList svx-ignore style="margin-bottom: var(--cds-spacing-08)">
|
||||||
- Medium (`md`): 672 - 1056px
|
<ListItem><strong>Small</strong> (`sm`): less than 672px</ListItem>
|
||||||
- Large (`lg`): 1056 - 1312px
|
<ListItem><strong>Medium</strong> (`md`): 672 - 1056px</ListItem>
|
||||||
- X-Large (`xlg`): 1312 - 1584px
|
<ListItem><strong>Large</strong> (`lg`): 1056 - 1312px</ListItem>
|
||||||
- Max (`max`): greater than 1584px
|
<ListItem><strong>X-Large</strong> (`xlg`): 1312 - 1584px</ListItem>
|
||||||
|
<ListItem><strong>Max</strong> (`max`): greater than 1584px</ListItem>
|
||||||
|
</UnorderedList>
|
||||||
|
|
||||||
This utility component uses the [Window.matchMedia API](https://developer.mozilla.org/en-US/docs/Web/API/Window/matchMedia) to declaratively determine the current Carbon breakpoint size.
|
This utility component uses the [Window.matchMedia API](https://developer.mozilla.org/en-US/docs/Web/API/Window/matchMedia) to declaratively determine the current Carbon breakpoint size.
|
||||||
|
|
||||||
### Default
|
### Default
|
||||||
|
|
||||||
|
Bind to the `size` prop to determine the current breakpoint size. Possible values include: `"sm" | "md" | "lg" | "xlg" | "max"`.
|
||||||
|
|
||||||
|
The `"on:match"` event will fire only when a breakpoint change event occurs (e.g., the browser width is resized).
|
||||||
|
|
||||||
<FileSource src="/framed/Breakpoint/Breakpoint" />
|
<FileSource src="/framed/Breakpoint/Breakpoint" />
|
|
@ -7,8 +7,17 @@
|
||||||
|
|
||||||
<Breakpoint bind:size on:match="{(e) => (events = [...events, e.detail])}" />
|
<Breakpoint bind:size on:match="{(e) => (events = [...events, e.detail])}" />
|
||||||
|
|
||||||
|
<p>Resize the width of your browser.</p>
|
||||||
|
<h6>Current breakpoint size</h6>
|
||||||
<h1>{size}</h1>
|
<h1>{size}</h1>
|
||||||
|
|
||||||
<pre>
|
<pre>
|
||||||
{JSON.stringify(events,null, 2)}
|
{JSON.stringify(events,null, 2)}
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
p,
|
||||||
|
h1 {
|
||||||
|
margin-bottom: var(--cds-spacing-08);
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue