@phcdevworks/spectre-components 1.14.0 → 1.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (156) hide show
  1. package/README.md +266 -86
  2. package/dist/alert.cjs.map +1 -1
  3. package/dist/alert.d.cts +2 -2
  4. package/dist/alert.d.ts +2 -2
  5. package/dist/alert.js.map +1 -1
  6. package/dist/avatar.cjs.map +1 -1
  7. package/dist/avatar.d.cts +2 -2
  8. package/dist/avatar.d.ts +2 -2
  9. package/dist/avatar.js.map +1 -1
  10. package/dist/badge.cjs.map +1 -1
  11. package/dist/badge.d.cts +2 -2
  12. package/dist/badge.d.ts +2 -2
  13. package/dist/badge.js.map +1 -1
  14. package/dist/button.cjs +6 -0
  15. package/dist/button.cjs.map +1 -1
  16. package/dist/button.d.cts +8 -2
  17. package/dist/button.d.ts +8 -2
  18. package/dist/button.js +6 -0
  19. package/dist/button.js.map +1 -1
  20. package/dist/card.cjs.map +1 -1
  21. package/dist/card.d.cts +2 -2
  22. package/dist/card.d.ts +2 -2
  23. package/dist/card.js.map +1 -1
  24. package/dist/container.cjs +17 -1
  25. package/dist/container.cjs.map +1 -1
  26. package/dist/container.d.cts +9 -2
  27. package/dist/container.d.ts +9 -2
  28. package/dist/container.js +17 -1
  29. package/dist/container.js.map +1 -1
  30. package/dist/dropdown.cjs +10 -1
  31. package/dist/dropdown.cjs.map +1 -1
  32. package/dist/dropdown.d.cts +8 -2
  33. package/dist/dropdown.d.ts +8 -2
  34. package/dist/dropdown.js +10 -1
  35. package/dist/dropdown.js.map +1 -1
  36. package/dist/footer-chip.cjs +411 -0
  37. package/dist/footer-chip.cjs.map +1 -0
  38. package/dist/footer-chip.d.cts +32 -0
  39. package/dist/footer-chip.d.ts +32 -0
  40. package/dist/footer-chip.js +408 -0
  41. package/dist/footer-chip.js.map +1 -0
  42. package/dist/footer-link.cjs +424 -0
  43. package/dist/footer-link.cjs.map +1 -0
  44. package/dist/footer-link.d.cts +43 -0
  45. package/dist/footer-link.d.ts +43 -0
  46. package/dist/footer-link.js +421 -0
  47. package/dist/footer-link.js.map +1 -0
  48. package/dist/footer.cjs +18 -2
  49. package/dist/footer.cjs.map +1 -1
  50. package/dist/footer.d.cts +7 -0
  51. package/dist/footer.d.ts +7 -0
  52. package/dist/footer.js +18 -2
  53. package/dist/footer.js.map +1 -1
  54. package/dist/{form-BGQjgJrL.d.cts → form-bHrr2vl7.d.cts} +40 -1
  55. package/dist/{form-BGQjgJrL.d.ts → form-bHrr2vl7.d.ts} +40 -1
  56. package/dist/grid.cjs +183 -1
  57. package/dist/grid.cjs.map +1 -1
  58. package/dist/grid.d.cts +63 -2
  59. package/dist/grid.d.ts +63 -2
  60. package/dist/grid.js +183 -1
  61. package/dist/grid.js.map +1 -1
  62. package/dist/icon-box.cjs.map +1 -1
  63. package/dist/icon-box.d.cts +2 -2
  64. package/dist/icon-box.d.ts +2 -2
  65. package/dist/icon-box.js.map +1 -1
  66. package/dist/index.cjs +631 -27
  67. package/dist/index.cjs.map +1 -1
  68. package/dist/index.d.cts +5 -1
  69. package/dist/index.d.ts +5 -1
  70. package/dist/index.js +625 -29
  71. package/dist/index.js.map +1 -1
  72. package/dist/input.cjs.map +1 -1
  73. package/dist/input.d.cts +2 -2
  74. package/dist/input.d.ts +2 -2
  75. package/dist/input.js.map +1 -1
  76. package/dist/nav-item.cjs +7 -1
  77. package/dist/nav-item.cjs.map +1 -1
  78. package/dist/nav-item.d.cts +7 -1
  79. package/dist/nav-item.d.ts +7 -1
  80. package/dist/nav-item.js +7 -1
  81. package/dist/nav-item.js.map +1 -1
  82. package/dist/nav.cjs +28 -2
  83. package/dist/nav.cjs.map +1 -1
  84. package/dist/nav.d.cts +14 -0
  85. package/dist/nav.d.ts +14 -0
  86. package/dist/nav.js +28 -2
  87. package/dist/nav.js.map +1 -1
  88. package/dist/rating.cjs.map +1 -1
  89. package/dist/rating.d.cts +2 -2
  90. package/dist/rating.d.ts +2 -2
  91. package/dist/rating.js.map +1 -1
  92. package/dist/section.cjs +22 -1
  93. package/dist/section.cjs.map +1 -1
  94. package/dist/section.d.cts +9 -0
  95. package/dist/section.d.ts +9 -0
  96. package/dist/section.js +22 -1
  97. package/dist/section.js.map +1 -1
  98. package/dist/select.cjs.map +1 -1
  99. package/dist/select.d.cts +1 -1
  100. package/dist/select.d.ts +1 -1
  101. package/dist/select.js.map +1 -1
  102. package/dist/sidebar-link.cjs +436 -0
  103. package/dist/sidebar-link.cjs.map +1 -0
  104. package/dist/sidebar-link.d.cts +50 -0
  105. package/dist/sidebar-link.d.ts +50 -0
  106. package/dist/sidebar-link.js +433 -0
  107. package/dist/sidebar-link.js.map +1 -0
  108. package/dist/sidebar-toggle.cjs +465 -0
  109. package/dist/sidebar-toggle.cjs.map +1 -0
  110. package/dist/sidebar-toggle.d.cts +44 -0
  111. package/dist/sidebar-toggle.d.ts +44 -0
  112. package/dist/sidebar-toggle.js +462 -0
  113. package/dist/sidebar-toggle.js.map +1 -0
  114. package/dist/sidebar.cjs +15 -10
  115. package/dist/sidebar.cjs.map +1 -1
  116. package/dist/sidebar.d.cts +7 -0
  117. package/dist/sidebar.d.ts +7 -0
  118. package/dist/sidebar.js +15 -10
  119. package/dist/sidebar.js.map +1 -1
  120. package/dist/spinner.cjs.map +1 -1
  121. package/dist/spinner.d.cts +2 -2
  122. package/dist/spinner.d.ts +2 -2
  123. package/dist/spinner.js.map +1 -1
  124. package/dist/stack.cjs +19 -5
  125. package/dist/stack.cjs.map +1 -1
  126. package/dist/stack.d.cts +9 -2
  127. package/dist/stack.d.ts +9 -2
  128. package/dist/stack.js +19 -5
  129. package/dist/stack.js.map +1 -1
  130. package/dist/tag.cjs.map +1 -1
  131. package/dist/tag.d.cts +2 -2
  132. package/dist/tag.d.ts +2 -2
  133. package/dist/tag.js.map +1 -1
  134. package/dist/testimonial.cjs.map +1 -1
  135. package/dist/testimonial.d.cts +2 -2
  136. package/dist/testimonial.d.ts +2 -2
  137. package/dist/testimonial.js.map +1 -1
  138. package/dist/text.cjs +1 -3
  139. package/dist/text.cjs.map +1 -1
  140. package/dist/text.d.cts +2 -2
  141. package/dist/text.d.ts +2 -2
  142. package/dist/text.js +1 -3
  143. package/dist/text.js.map +1 -1
  144. package/dist/textarea.cjs.map +1 -1
  145. package/dist/textarea.d.cts +1 -1
  146. package/dist/textarea.d.ts +1 -1
  147. package/dist/textarea.js.map +1 -1
  148. package/dist/toast.cjs.map +1 -1
  149. package/dist/toast.d.cts +2 -2
  150. package/dist/toast.d.ts +2 -2
  151. package/dist/toast.js.map +1 -1
  152. package/dist/tooltip.cjs.map +1 -1
  153. package/dist/tooltip.d.cts +2 -2
  154. package/dist/tooltip.d.ts +2 -2
  155. package/dist/tooltip.js.map +1 -1
  156. package/package.json +34 -14
package/README.md CHANGED
@@ -16,7 +16,7 @@ consume Spectre without a framework-specific adapter.
16
16
  | Project team | `project-design` |
17
17
  | Repository role | Spectre L3a Lit web component layer |
18
18
  | Package/artifact | `@phcdevworks/spectre-components` |
19
- | Current version/status | 1.14.0 |
19
+ | Current version/status | 1.16.0 |
20
20
 
21
21
  ## Standard Workflow
22
22
 
@@ -347,6 +347,7 @@ when the button needs to navigate rather than submit/act.
347
347
  | `disabled` | boolean | `false` | Disables the button; if `href` is also set, still renders `<button disabled>` |
348
348
  | `full-width` | boolean | `false` | Spans full container width |
349
349
  | `pill` | boolean | `false` | Pill / fully-rounded corners |
350
+ | `compact` | boolean | `false` | Denser padding/height variant |
350
351
  | `name` | string | — | Form field name |
351
352
  | `value` | string | `''` | Submitted value |
352
353
  | `form` | string | — | Associates with a form by ID |
@@ -812,16 +813,41 @@ price, feature list, call-to-action, etc.).
812
813
 
813
814
  ---
814
815
 
816
+ ### Layout components
817
+
818
+ `sp-container`, `sp-grid`, `sp-section`, `sp-stack`, `sp-footer`, and `sp-nav`
819
+ share two contracts:
820
+
821
+ - **Host display** — the host element defaults to `display: block` (set via
822
+ inline style in `connectedCallback`, so a consumer's own
823
+ `style="display: ..."` always wins) instead of the browser's default inline
824
+ custom-element box. This keeps backgrounds, margins, and full-width inner
825
+ content from being trapped inside an inline box.
826
+ - **`inner-class`** — an `inner-class` attribute (`innerClass` JS property)
827
+ appends consumer-supplied Spectre utility classes to the native inner element
828
+ the component's recipe classes render on, without touching the host's own
829
+ `class` attribute. Host `class` and `inner-class` are distinct targets: host
830
+ `class` affects the custom-element box itself, `inner-class` affects the
831
+ styled element inside it. Only tokens matching `sp-*` (Spectre utility class
832
+ syntax) are applied; anything else is silently dropped.
833
+
834
+ ```html
835
+ <sp-stack class="my-host-hook" inner-class="sp-bg-primary-500 sp-p-8">
836
+ ...
837
+ </sp-stack>
838
+ ```
839
+
815
840
  ### sp-container
816
841
 
817
842
  Renders a `<div>` layout container backed by the Spectre container recipe.
818
843
 
819
844
  **Attributes**
820
845
 
821
- | Attribute | Type | Default | Description |
822
- | ------------------------- | ------- | ------- | --------------------------------- |
823
- | `max-width` | `prose` | — | Constrains content to a max width |
824
- | `id` / `title` / `aria-*` | string | — | Forwarded to the native `<div>` |
846
+ | Attribute | Type | Default | Description |
847
+ | ------------------------- | ------- | ------- | ----------------------------------------------------- |
848
+ | `max-width` | `prose` | — | Constrains content to a max width |
849
+ | `inner-class` | string | — | Spectre utility classes applied to the native `<div>` |
850
+ | `id` / `title` / `aria-*` | string | — | Forwarded to the native `<div>` |
825
851
 
826
852
  **Content projection** — children become the container content.
827
853
 
@@ -835,12 +861,26 @@ Renders a `<div>` grid layout backed by the Spectre grid recipe.
835
861
 
836
862
  **Attributes**
837
863
 
838
- | Attribute | Type | Default | Description |
839
- | ------------------------- | ------------------------------------------------------------ | ------- | ----------------------------------------------------------- |
840
- | `columns` | `1 \| 2 \| 3 \| 4 \| 6 \| 12` | `1` | Number of grid columns |
841
- | `gap` | `sm \| md \| lg` | `md` | Gap between grid items |
842
- | `span` | `1-12 \| 'full'` or `{ base?, md?, lg? }` (JS property only) | — | Column span for a grid item, single value or per-breakpoint |
843
- | `id` / `title` / `aria-*` | string | — | Forwarded to the native `<div>` |
864
+ | Attribute | Type | Default | Description |
865
+ | ------------------------- | ---------------------------------------------------------------------------------------- | ------- | ------------------------------------------------------------------------------- |
866
+ | `columns` | `1 \| 2 \| 3 \| 4 \| 6 \| 12` | `1` | Number of grid columns |
867
+ | `gap` | `sm \| md \| lg` | `md` | Gap between grid items |
868
+ | `span` | `1-12 \| 'full'` or `{ base?, md?, lg? }` (JS property only) | — | Column span for a grid item, single value or per-breakpoint |
869
+ | `column-gap` | `sm \| md \| lg` (JS: `columnGap`) | — | Overrides `gap` on the column axis only |
870
+ | `row-gap` | `sm \| md \| lg` (JS: `rowGap`) | — | Overrides `gap` on the row axis only |
871
+ | `offset` | `0-11` or `{ base?, md?, lg? }` (JS property only) | — | Column offset for a grid item, single value or per-breakpoint |
872
+ | `row-span` | `1-12 \| 'full'` or `{ base?, md?, lg? }` (JS: `rowSpan`) | — | Row span for a grid item, single value or per-breakpoint |
873
+ | `row-offset` | `0-11` or `{ base?, md?, lg? }` (JS: `rowOffset`) | — | Row offset for a grid item, single value or per-breakpoint |
874
+ | `order` | `'first' \| 'last' \| 'none' \| 1-12` or `{ base?, md?, lg? }` (JS property only) | — | Reorders a grid item independent of source order |
875
+ | `leading-tracks` | `{ weight: 1.5\|1.6\|2\|2.5\|3 \| { base?, md?, lg? } }` (JS: `leadingTracks`) | — | One wider leading column plus `columns - 1` equal columns |
876
+ | `fixed-tracks` | `{ count: 1\|2\|3\|4 }` (JS: `fixedTracks`) | — | Fixed-width repeated tracks (`--sp-space-240`), replaces `columns` |
877
+ | `explicit-template` | `{ template: 'edge-fluid-edge'\|'label-fluid-fluid', weight? }` (JS: `explicitTemplate`) | — | Named asymmetric column shape; replaces `columns`/`leadingTracks`/`fixedTracks` |
878
+ | `inner-class` | string | — | Spectre utility classes applied to the native `<div>` |
879
+ | `id` / `title` / `aria-*` | string | — | Forwarded to the native `<div>` |
880
+
881
+ `leading-tracks`, `fixed-tracks`, `explicit-template`, and any per-breakpoint
882
+ `{ base?, md?, lg? }` shape are JS-property-only (set via the DOM property, not
883
+ an HTML attribute string).
844
884
 
845
885
  **Content projection** — children become grid items.
846
886
 
@@ -854,9 +894,10 @@ Renders a `<section>` layout wrapper backed by the Spectre section recipe.
854
894
 
855
895
  **Attributes**
856
896
 
857
- | Attribute | Type | Default | Description |
858
- | ------------------------- | ------ | ------- | ----------------------------------- |
859
- | `id` / `title` / `aria-*` | string | — | Forwarded to the native `<section>` |
897
+ | Attribute | Type | Default | Description |
898
+ | ------------------------- | ------ | ------- | --------------------------------------------------------- |
899
+ | `inner-class` | string | — | Spectre utility classes applied to the native `<section>` |
900
+ | `id` / `title` / `aria-*` | string | — | Forwarded to the native `<section>` |
860
901
 
861
902
  **Content projection** — children become the section content.
862
903
 
@@ -870,12 +911,13 @@ Renders a `<div>` flex stack backed by the Spectre stack recipe.
870
911
 
871
912
  **Attributes**
872
913
 
873
- | Attribute | Type | Default | Description |
874
- | ------------------------- | ------------------------ | ---------- | ------------------------------------- |
875
- | `direction` | `vertical \| horizontal` | `vertical` | Stack axis |
876
- | `basis` | `sidebar` | — | Reserves sidebar-sized basis on items |
877
- | `align` | `center \| stretch` | `center` | Cross-axis alignment |
878
- | `id` / `title` / `aria-*` | string | — | Forwarded to the native `<div>` |
914
+ | Attribute | Type | Default | Description |
915
+ | ------------------------- | ------------------------ | ---------- | ----------------------------------------------------- |
916
+ | `direction` | `vertical \| horizontal` | `vertical` | Stack axis |
917
+ | `basis` | `sidebar` | — | Reserves sidebar-sized basis on items |
918
+ | `align` | `center \| stretch` | `center` | Cross-axis alignment |
919
+ | `inner-class` | string | — | Spectre utility classes applied to the native `<div>` |
920
+ | `id` / `title` / `aria-*` | string | — | Forwarded to the native `<div>` |
879
921
 
880
922
  **Content projection** — children become stack items.
881
923
 
@@ -889,11 +931,12 @@ Renders a `<footer>` backed by the Spectre footer recipe.
889
931
 
890
932
  **Attributes**
891
933
 
892
- | Attribute | Type | Default | Description |
893
- | ------------------------- | ------- | ------- | ---------------------------------- |
894
- | `bordered` | boolean | `false` | Adds a top border |
895
- | `full-width` | boolean | `false` | Spans full container width |
896
- | `id` / `title` / `aria-*` | string | — | Forwarded to the native `<footer>` |
934
+ | Attribute | Type | Default | Description |
935
+ | ------------------------- | ------- | ------- | -------------------------------------------------------- |
936
+ | `bordered` | boolean | `false` | Adds a top border |
937
+ | `full-width` | boolean | `false` | Spans full container width |
938
+ | `inner-class` | string | — | Spectre utility classes applied to the native `<footer>` |
939
+ | `id` / `title` / `aria-*` | string | — | Forwarded to the native `<footer>` |
897
940
 
898
941
  **Content projection** — children become the footer content (links, legal text,
899
942
  etc.).
@@ -902,18 +945,66 @@ etc.).
902
945
 
903
946
  ---
904
947
 
948
+ ### sp-footer-link
949
+
950
+ Renders an `<a>` link styled for `sp-footer` content, backed by the Spectre
951
+ footer link recipe.
952
+
953
+ **Attributes**
954
+
955
+ | Attribute | Type | Default | Description |
956
+ | ------------------------- | ------- | ------- | --------------------------------------------------------------- |
957
+ | `href` | string | — | Link target (dropped when `disabled`) |
958
+ | `active` | boolean | `false` | Marks the link as the current page (`aria-current="page"`) |
959
+ | `disabled` | boolean | `false` | Disables the link (`aria-disabled`, `tabindex="-1"`, no `href`) |
960
+ | `id` / `title` / `aria-*` | string | — | Forwarded to the native `<a>` |
961
+
962
+ **Content projection** — children become the link text.
963
+
964
+ **Internal target** — `[data-sp-footer-link-native]` selects the native `<a>`.
965
+
966
+ ```html
967
+ <sp-footer>
968
+ <sp-footer-link href="/privacy">Privacy</sp-footer-link>
969
+ <sp-footer-link href="/terms" active>Terms</sp-footer-link>
970
+ </sp-footer>
971
+ ```
972
+
973
+ ---
974
+
975
+ ### sp-footer-chip
976
+
977
+ Renders a `<span>` chip styled for `sp-footer` content (e.g. a version or status
978
+ badge), backed by the Spectre footer chip recipe.
979
+
980
+ **Attributes**
981
+
982
+ | Attribute | Type | Default | Description |
983
+ | ------------------------- | ------- | ------- | --------------------------------------- |
984
+ | `disabled` | boolean | `false` | Disabled visual state (`aria-disabled`) |
985
+ | `id` / `title` / `aria-*` | string | — | Forwarded to the native `<span>` |
986
+
987
+ **Content projection** — children become the chip text.
988
+
989
+ **Internal target** — `[data-sp-footer-chip-native]` selects the native
990
+ `<span>`.
991
+
992
+ ---
993
+
905
994
  ### sp-nav
906
995
 
907
996
  Renders a `<nav>` backed by the Spectre nav recipe.
908
997
 
909
998
  **Attributes**
910
999
 
911
- | Attribute | Type | Default | Description |
912
- | ------------------------- | ------- | ------- | ------------------------------- |
913
- | `bordered` | boolean | `false` | Adds a bottom border |
914
- | `sticky` | boolean | `false` | Sticks the nav to the viewport |
915
- | `full-width` | boolean | `false` | Spans full container width |
916
- | `id` / `title` / `aria-*` | string | — | Forwarded to the native `<nav>` |
1000
+ | Attribute | Type | Default | Description |
1001
+ | ------------------------- | ------------------------ | ------- | ----------------------------------------------------- |
1002
+ | `bordered` | boolean | `false` | Adds a bottom border |
1003
+ | `sticky` | boolean | `false` | Sticks the nav to the viewport |
1004
+ | `full-width` | boolean | `false` | Spans full container width |
1005
+ | `align` | `start \| center \| end` | — | Horizontal alignment of nav content within the bar |
1006
+ | `inner-class` | string | — | Spectre utility classes applied to the native `<nav>` |
1007
+ | `id` / `title` / `aria-*` | string | — | Forwarded to the native `<nav>` |
917
1008
 
918
1009
  **Content projection** — children become the nav content (links, brand mark,
919
1010
  etc.).
@@ -930,14 +1021,15 @@ alongside plain `<a>` links.
930
1021
 
931
1022
  **Attributes**
932
1023
 
933
- | Attribute | Type | Default | Description |
934
- | ------------------------- | ------- | ---------------- | ------------------------------------------------------------------- |
935
- | `dropdown` | boolean | `false` | Renders a dropdown trigger + menu instead of a plain `<a>` |
936
- | `href` | string | — | Link target when `dropdown` is `false` |
937
- | `label` | string | — | Trigger/link text when no content is projected |
938
- | `open` | boolean | `false` | Open/closed menu state (dropdown mode only) |
939
- | `placement` | string | `'bottom-start'` | Menu position: `bottom-start`, `bottom-end`, `top-start`, `top-end` |
940
- | `id` / `title` / `aria-*` | string | — | Forwarded to the rendered `<a>` or trigger `<button>` |
1024
+ | Attribute | Type | Default | Description |
1025
+ | ------------------------- | ------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------ |
1026
+ | `dropdown` | boolean | `false` | Renders a dropdown trigger + menu instead of a plain `<a>` |
1027
+ | `href` | string | — | Link target when `dropdown` is `false` |
1028
+ | `label` | string | — | Trigger/link text when no content is projected |
1029
+ | `mega` | boolean | `false` | Anchors the menu to the nearest positioned ancestor instead of the trigger, spanning its full width (dropdown mode only) |
1030
+ | `open` | boolean | `false` | Open/closed menu state (dropdown mode only) |
1031
+ | `placement` | string | `'bottom-start'` | Menu position: `bottom-start`, `bottom-end`, `top-start`, `top-end` |
1032
+ | `id` / `title` / `aria-*` | string | — | Forwarded to the rendered `<a>` or trigger `<button>` |
941
1033
 
942
1034
  **Content projection** — in dropdown mode, children become the menu content; a
943
1035
  child with `slot="trigger"` becomes the trigger content instead of `label`. Menu
@@ -959,9 +1051,20 @@ layout. In link mode, children become the link's content.
959
1051
  <div>Column three</div>
960
1052
  </sp-grid>
961
1053
  </sp-nav-item>
1054
+ <sp-nav-item dropdown mega label="Solutions">
1055
+ <sp-grid columns="4" gap="lg">
1056
+ <div>Column one</div>
1057
+ <div>Column two</div>
1058
+ <div>Column three</div>
1059
+ <div>Column four</div>
1060
+ </sp-grid>
1061
+ </sp-nav-item>
962
1062
  </sp-nav>
963
1063
  ```
964
1064
 
1065
+ `mega` requires a positioned ancestor to anchor against — `sp-nav` is a
1066
+ positioning context by default, so nesting inside it is sufficient.
1067
+
965
1068
  ---
966
1069
 
967
1070
  ### sp-sidebar
@@ -971,12 +1074,13 @@ Spectre sidebar recipe.
971
1074
 
972
1075
  **Attributes**
973
1076
 
974
- | Attribute | Type | Default | Description |
975
- | ------------------------- | ------- | ---------------- | -------------------------------------- |
976
- | `bordered` | boolean | `false` | Adds a trailing border |
977
- | `open` | boolean | `false` | Open/closed off-canvas state |
978
- | `toggle-label` | string | `Toggle sidebar` | Accessible label for the toggle button |
979
- | `id` / `title` / `aria-*` | string | — | Forwarded to the native `<aside>` |
1077
+ | Attribute | Type | Default | Description |
1078
+ | ------------------------- | ------- | ---------------- | ------------------------------------------------------------------------------------- |
1079
+ | `bordered` | boolean | `false` | Adds a trailing border |
1080
+ | `hide-toggle` | boolean | `false` | Suppresses the built-in toggle button (e.g. when using `sp-sidebar-toggle` elsewhere) |
1081
+ | `open` | boolean | `false` | Open/closed off-canvas state |
1082
+ | `toggle-label` | string | `Toggle sidebar` | Accessible label for the built-in toggle button |
1083
+ | `id` / `title` / `aria-*` | string | — | Forwarded to the native `<aside>` |
980
1084
 
981
1085
  **Content projection** — children become the sidebar content (links, navigation
982
1086
  groups, etc.).
@@ -993,6 +1097,76 @@ hide the off-canvas panel and backdrop.
993
1097
 
994
1098
  ---
995
1099
 
1100
+ ### sp-sidebar-link
1101
+
1102
+ Renders an `<a>` link styled for `sp-sidebar` navigation content, backed by the
1103
+ Spectre sidebar link recipe.
1104
+
1105
+ **Attributes**
1106
+
1107
+ | Attribute | Type | Default | Description |
1108
+ | ------------------------- | ----------------- | -------- | --------------------------------------------------------------- |
1109
+ | `href` | string | — | Link target (dropped when `disabled`) |
1110
+ | `active` | boolean | `false` | Marks the link as the current page (`aria-current="page"`) |
1111
+ | `disabled` | boolean | `false` | Disables the link (`aria-disabled`, `tabindex="-1"`, no `href`) |
1112
+ | `level` | `parent \| child` | `parent` | Indents/styles the link as a nested (`child`) sidebar link |
1113
+ | `id` / `title` / `aria-*` | string | — | Forwarded to the native `<a>` |
1114
+
1115
+ **Content projection** — children become the link text.
1116
+
1117
+ **Internal target** — `[data-sp-sidebar-link-native]` selects the native `<a>`.
1118
+
1119
+ ```html
1120
+ <sp-sidebar>
1121
+ <sp-sidebar-link href="/dashboard" active>Dashboard</sp-sidebar-link>
1122
+ <sp-sidebar-link href="/settings">Settings</sp-sidebar-link>
1123
+ <sp-sidebar-link href="/settings/billing" level="child"
1124
+ >Billing</sp-sidebar-link
1125
+ >
1126
+ </sp-sidebar>
1127
+ ```
1128
+
1129
+ ---
1130
+
1131
+ ### sp-sidebar-toggle
1132
+
1133
+ Renders a standalone trigger button that opens/closes a remote `sp-sidebar`,
1134
+ backed by the Spectre sidebar-toggle recipe. Use it to place a toggle somewhere
1135
+ other than inside the sidebar itself (a header, a nav bar) — pair it with
1136
+ `hide-toggle` on the target `sp-sidebar` to suppress that sidebar's own built-in
1137
+ toggle, or leave both in place to control the same sidebar from two triggers.
1138
+
1139
+ **Attributes**
1140
+
1141
+ | Attribute | Type | Default | Description |
1142
+ | ------------------------- | ------ | ---------------- | ------------------------------------------------------------------------------------------------ |
1143
+ | `for` | string | — | `id` of the target `sp-sidebar`'s native content (the id set on the `sp-sidebar` element itself) |
1144
+ | `label` | string | `Toggle sidebar` | Accessible label when no icon content is projected |
1145
+ | `id` / `title` / `aria-*` | string | — | Forwarded to the native `<button>` |
1146
+
1147
+ **Content projection** — children become the button's icon content; falls back
1148
+ to a default `☰` glyph when empty.
1149
+
1150
+ **Behavior** — clicking the button toggles the target `sp-sidebar`'s `open`
1151
+ property and mirrors its own `aria-expanded` state, including staying in sync
1152
+ when the target is opened/closed by another trigger (its own built-in toggle,
1153
+ the backdrop, `Esc`, or a second `sp-sidebar-toggle`).
1154
+
1155
+ ```html
1156
+ <sp-nav>
1157
+ <sp-sidebar-toggle for="app-sidebar"></sp-sidebar-toggle>
1158
+ </sp-nav>
1159
+
1160
+ <sp-sidebar id="app-sidebar" hide-toggle>
1161
+ <a href="/dashboard">Dashboard</a>
1162
+ </sp-sidebar>
1163
+ ```
1164
+
1165
+ **Internal target** — `[data-sp-sidebar-toggle-native]` selects the native
1166
+ `<button>`.
1167
+
1168
+ ---
1169
+
996
1170
  ### sp-dropdown
997
1171
 
998
1172
  Renders a trigger button and a menu container, backed by the Spectre dropdown
@@ -1000,13 +1174,14 @@ recipes.
1000
1174
 
1001
1175
  **Attributes**
1002
1176
 
1003
- | Attribute | Type | Default | Description |
1004
- | ------------------------- | ---------------------------------------------------- | -------------- | ----------------------------------------------------------------------------- |
1005
- | `open` | boolean | `false` | Open/closed menu state |
1006
- | `placement` | `bottom-start \| bottom-end \| top-start \| top-end` | `bottom-start` | Menu position relative to trigger |
1007
- | `full-width` | boolean | `false` | Spans full container width |
1008
- | `trigger-label` | string | `Toggle menu` | Visible/accessible trigger text when no `slot="trigger"` content is projected |
1009
- | `id` / `title` / `aria-*` | string | — | Forwarded to the trigger button |
1177
+ | Attribute | Type | Default | Description |
1178
+ | ------------------------- | ---------------------------------------------------- | -------------- | --------------------------------------------------------------------------------------------------- |
1179
+ | `open` | boolean | `false` | Open/closed menu state |
1180
+ | `placement` | `bottom-start \| bottom-end \| top-start \| top-end` | `bottom-start` | Menu position relative to trigger |
1181
+ | `full-width` | boolean | `false` | Spans full container width |
1182
+ | `mega` | boolean | `false` | Anchors the menu to the nearest positioned ancestor instead of the trigger, spanning its full width |
1183
+ | `trigger-label` | string | `Toggle menu` | Visible/accessible trigger text when no `slot="trigger"` content is projected |
1184
+ | `id` / `title` / `aria-*` | string | — | Forwarded to the trigger button |
1010
1185
 
1011
1186
  **Content projection** — an element with `slot="trigger"` becomes the trigger
1012
1187
  button content; all other children become the menu content.
@@ -1196,45 +1371,50 @@ defineSpectreComponents() // registers all sp-* elements
1196
1371
  **Interactive constants and types**: `spectreDropdownPlacements`,
1197
1372
  `spectreToastVariants`, `spectreTooltipPlacements`, `SpectreDropdownPlacement`,
1198
1373
  `SpectreToastVariant`, `SpectreTooltipPlacement`, `SpectreFooterProps`,
1199
- `SpectreNavProps`, `SpectreSidebarProps`, `SpectreDropdownProps`,
1200
- `SpectreModalProps`, `SpectreToastProps`, `SpectreTooltipProps`
1374
+ `SpectreNavProps`, `SpectreSidebarProps`, `SpectreSidebarToggleProps`,
1375
+ `SpectreDropdownProps`, `SpectreModalProps`, `SpectreToastProps`,
1376
+ `SpectreTooltipProps`
1201
1377
 
1202
1378
  ### Subpath entry points
1203
1379
 
1204
1380
  Each entry point registers only that component and exports only its surface:
1205
1381
 
1206
- | Entry point | Registers | Key exports |
1207
- | ------------------ | ----------------- | ---------------------------------------------------------------------------------------- |
1208
- | `.../button` | `sp-button` | `defineSpectreButton`, `SpectreButtonElement`, button constants and types |
1209
- | `.../input` | `sp-input` | `defineSpectreInput`, `SpectreInputElement`, input constants and types |
1210
- | `.../textarea` | `sp-textarea` | `defineSpectreTextarea`, `SpectreTextareaElement`, `SpectreTextareaProps` |
1211
- | `.../select` | `sp-select` | `defineSpectreSelect`, `SpectreSelectElement`, `SpectreSelectProps` |
1212
- | `.../checkbox` | `sp-checkbox` | `defineSpectreCheckbox`, `SpectreCheckboxElement`, `SpectreCheckboxProps` |
1213
- | `.../radio` | `sp-radio` | `defineSpectreRadio`, `SpectreRadioElement`, `SpectreRadioProps` |
1214
- | `.../label` | `sp-label` | `defineSpectreLabel`, `SpectreLabelElement`, `SpectreLabelProps` |
1215
- | `.../fieldset` | `sp-fieldset` | `defineSpectreFieldset`, `SpectreFieldsetElement`, `SpectreFieldsetProps` |
1216
- | `.../badge` | `sp-badge` | `defineSpectreBadge`, `SpectreBadgeElement`, badge constants and types |
1217
- | `.../card` | `sp-card` | `defineSpectreCard`, `SpectreCardElement`, card constants and types |
1218
- | `.../icon-box` | `sp-icon-box` | `defineSpectreIconBox`, `SpectreIconBoxElement`, icon-box constants and types |
1219
- | `.../rating` | `sp-rating` | `defineSpectreRating`, `SpectreRatingElement`, rating constants and types |
1220
- | `.../testimonial` | `sp-testimonial` | `defineSpectreTestimonial`, `SpectreTestimonialElement`, testimonial constants and types |
1221
- | `.../alert` | `sp-alert` | `defineSpectreAlert`, `SpectreAlertElement`, alert constants and types |
1222
- | `.../avatar` | `sp-avatar` | `defineSpectreAvatar`, `SpectreAvatarElement`, avatar constants and types |
1223
- | `.../spinner` | `sp-spinner` | `defineSpectreSpinner`, `SpectreSpinnerElement`, spinner constants and types |
1224
- | `.../tag` | `sp-tag` | `defineSpectreTag`, `SpectreTagElement`, tag constants and types |
1225
- | `.../pricing-card` | `sp-pricing-card` | `defineSpectrePricingCard`, `SpectrePricingCardElement`, `SpectrePricingCardProps` |
1226
- | `.../container` | `sp-container` | `defineSpectreContainer`, `SpectreContainerElement`, container constants and types |
1227
- | `.../grid` | `sp-grid` | `defineSpectreGrid`, `SpectreGridElement`, grid constants and types |
1228
- | `.../section` | `sp-section` | `defineSpectreSection`, `SpectreSectionElement`, `SpectreSectionProps` |
1229
- | `.../stack` | `sp-stack` | `defineSpectreStack`, `SpectreStackElement`, stack constants and types |
1230
- | `.../nav` | `sp-nav` | `defineSpectreNav`, `SpectreNavElement`, `SpectreNavProps` |
1231
- | `.../nav-item` | `sp-nav-item` | `defineSpectreNavItem`, `SpectreNavItemElement`, `SpectreNavItemProps` |
1232
- | `.../sidebar` | `sp-sidebar` | `defineSpectreSidebar`, `SpectreSidebarElement`, `SpectreSidebarProps` |
1233
- | `.../dropdown` | `sp-dropdown` | `defineSpectreDropdown`, `SpectreDropdownElement`, dropdown constants and types |
1234
- | `.../footer` | `sp-footer` | `defineSpectreFooter`, `SpectreFooterElement`, `SpectreFooterProps` |
1235
- | `.../modal` | `sp-modal` | `defineSpectreModal`, `SpectreModalElement`, `SpectreModalProps` |
1236
- | `.../toast` | `sp-toast` | `defineSpectreToast`, `SpectreToastElement`, toast constants and types |
1237
- | `.../tooltip` | `sp-tooltip` | `defineSpectreTooltip`, `SpectreTooltipElement`, tooltip constants and types |
1382
+ | Entry point | Registers | Key exports |
1383
+ | -------------------- | ------------------- | ---------------------------------------------------------------------------------------- |
1384
+ | `.../button` | `sp-button` | `defineSpectreButton`, `SpectreButtonElement`, button constants and types |
1385
+ | `.../input` | `sp-input` | `defineSpectreInput`, `SpectreInputElement`, input constants and types |
1386
+ | `.../textarea` | `sp-textarea` | `defineSpectreTextarea`, `SpectreTextareaElement`, `SpectreTextareaProps` |
1387
+ | `.../select` | `sp-select` | `defineSpectreSelect`, `SpectreSelectElement`, `SpectreSelectProps` |
1388
+ | `.../checkbox` | `sp-checkbox` | `defineSpectreCheckbox`, `SpectreCheckboxElement`, `SpectreCheckboxProps` |
1389
+ | `.../radio` | `sp-radio` | `defineSpectreRadio`, `SpectreRadioElement`, `SpectreRadioProps` |
1390
+ | `.../label` | `sp-label` | `defineSpectreLabel`, `SpectreLabelElement`, `SpectreLabelProps` |
1391
+ | `.../fieldset` | `sp-fieldset` | `defineSpectreFieldset`, `SpectreFieldsetElement`, `SpectreFieldsetProps` |
1392
+ | `.../badge` | `sp-badge` | `defineSpectreBadge`, `SpectreBadgeElement`, badge constants and types |
1393
+ | `.../card` | `sp-card` | `defineSpectreCard`, `SpectreCardElement`, card constants and types |
1394
+ | `.../icon-box` | `sp-icon-box` | `defineSpectreIconBox`, `SpectreIconBoxElement`, icon-box constants and types |
1395
+ | `.../rating` | `sp-rating` | `defineSpectreRating`, `SpectreRatingElement`, rating constants and types |
1396
+ | `.../testimonial` | `sp-testimonial` | `defineSpectreTestimonial`, `SpectreTestimonialElement`, testimonial constants and types |
1397
+ | `.../alert` | `sp-alert` | `defineSpectreAlert`, `SpectreAlertElement`, alert constants and types |
1398
+ | `.../avatar` | `sp-avatar` | `defineSpectreAvatar`, `SpectreAvatarElement`, avatar constants and types |
1399
+ | `.../spinner` | `sp-spinner` | `defineSpectreSpinner`, `SpectreSpinnerElement`, spinner constants and types |
1400
+ | `.../tag` | `sp-tag` | `defineSpectreTag`, `SpectreTagElement`, tag constants and types |
1401
+ | `.../pricing-card` | `sp-pricing-card` | `defineSpectrePricingCard`, `SpectrePricingCardElement`, `SpectrePricingCardProps` |
1402
+ | `.../container` | `sp-container` | `defineSpectreContainer`, `SpectreContainerElement`, container constants and types |
1403
+ | `.../grid` | `sp-grid` | `defineSpectreGrid`, `SpectreGridElement`, grid constants and types |
1404
+ | `.../section` | `sp-section` | `defineSpectreSection`, `SpectreSectionElement`, `SpectreSectionProps` |
1405
+ | `.../stack` | `sp-stack` | `defineSpectreStack`, `SpectreStackElement`, stack constants and types |
1406
+ | `.../nav` | `sp-nav` | `defineSpectreNav`, `SpectreNavElement`, `SpectreNavProps` |
1407
+ | `.../nav-item` | `sp-nav-item` | `defineSpectreNavItem`, `SpectreNavItemElement`, `SpectreNavItemProps` |
1408
+ | `.../sidebar` | `sp-sidebar` | `defineSpectreSidebar`, `SpectreSidebarElement`, `SpectreSidebarProps` |
1409
+ | `.../sidebar-link` | `sp-sidebar-link` | `defineSpectreSidebarLink`, `SpectreSidebarLinkElement`, `SpectreSidebarLinkProps` |
1410
+ | `.../sidebar-toggle` | `sp-sidebar-toggle` | `defineSpectreSidebarToggle`, `SpectreSidebarToggleElement`, `SpectreSidebarToggleProps` |
1411
+ | `.../dropdown` | `sp-dropdown` | `defineSpectreDropdown`, `SpectreDropdownElement`, dropdown constants and types |
1412
+ | `.../footer` | `sp-footer` | `defineSpectreFooter`, `SpectreFooterElement`, `SpectreFooterProps` |
1413
+ | `.../footer-link` | `sp-footer-link` | `defineSpectreFooterLink`, `SpectreFooterLinkElement`, `SpectreFooterLinkProps` |
1414
+ | `.../footer-chip` | `sp-footer-chip` | `defineSpectreFooterChip`, `SpectreFooterChipElement`, `SpectreFooterChipProps` |
1415
+ | `.../modal` | `sp-modal` | `defineSpectreModal`, `SpectreModalElement`, `SpectreModalProps` |
1416
+ | `.../toast` | `sp-toast` | `defineSpectreToast`, `SpectreToastElement`, toast constants and types |
1417
+ | `.../tooltip` | `sp-tooltip` | `defineSpectreTooltip`, `SpectreTooltipElement`, tooltip constants and types |
1238
1418
 
1239
1419
  Size constants are shared between input, textarea, and select. Import
1240
1420
  `spectreInputSizes` / `SpectreInputSize` from `.../input` when needed alongside