diff --git a/COMPONENT_INDEX.md b/COMPONENT_INDEX.md
index 4c5249f1..e9196814 100644
--- a/COMPONENT_INDEX.md
+++ b/COMPONENT_INDEX.md
@@ -348,6 +348,14 @@ None.
## `Breakpoint`
+### Types
+
+```ts
+export type BreakpointSize = "sm" | "md" | "lg" | "xlg" | "max";
+
+export type BreakpointValue = 320 | 672 | 1056 | 1312 | 1584;
+```
+
### Props
| Prop name | Kind | Reactive | Type | Default value | Description |
diff --git a/docs/src/COMPONENT_API.json b/docs/src/COMPONENT_API.json
index 7b5c2ea3..74132829 100644
--- a/docs/src/COMPONENT_API.json
+++ b/docs/src/COMPONENT_API.json
@@ -403,7 +403,18 @@
"detail": "{ size: BreakpointSize; breakpointValue: BreakpointValue; }"
}
],
- "typedefs": []
+ "typedefs": [
+ {
+ "type": "\"sm\" | \"md\" | \"lg\" | \"xlg\" | \"max\"",
+ "name": "BreakpointSize",
+ "ts": "type BreakpointSize = \"sm\" | \"md\" | \"lg\" | \"xlg\" | \"max\""
+ },
+ {
+ "type": "320 | 672 | 1056 | 1312 | 1584",
+ "name": "BreakpointValue",
+ "ts": "type BreakpointValue = 320 | 672 | 1056 | 1312 | 1584"
+ }
+ ]
},
{
"moduleName": "Button",
diff --git a/docs/src/pages/components/Breakpoint.svx b/docs/src/pages/components/Breakpoint.svx
index 082f57bc..22bf672f 100644
--- a/docs/src/pages/components/Breakpoint.svx
+++ b/docs/src/pages/components/Breakpoint.svx
@@ -22,6 +22,14 @@ This utility component uses the [Window.matchMedia API](https://developer.mozill
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).
+The `"on:change"` event will fire when the size is initially determined and when a breakpoint change event occurs (e.g., the browser width is resized).
-
Resize the width of your browser.
{JSON.stringify(events, null, 2)}diff --git a/docs/src/pages/framed/Breakpoint/BreakpointObserver.svelte b/docs/src/pages/framed/Breakpoint/BreakpointObserver.svelte new file mode 100644 index 00000000..a37e4683 --- /dev/null +++ b/docs/src/pages/framed/Breakpoint/BreakpointObserver.svelte @@ -0,0 +1,15 @@ + + +
Current breakpoint size: {$size}
+Current breakpoint value: {breakpoints[$size]}px
+Smaller than medium: {$smaller}
+Larger than medium: {$larger}
diff --git a/src/Breakpoint/Breakpoint.svelte b/src/Breakpoint/Breakpoint.svelte index 740d6ea2..8eb93c8c 100644 --- a/src/Breakpoint/Breakpoint.svelte +++ b/src/Breakpoint/Breakpoint.svelte @@ -1,5 +1,7 @@