@oicl/openbridge-webcomponents-full-bundle 2.2.0-next.22 → 2.2.0-next.23
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.
- package/custom-elements-manifest.config.mjs +2 -1
- package/custom-elements.json +312 -17
- package/llms/components/obc-accordion-card.md +141 -0
- package/llms/components/obc-accordion-item.md +90 -0
- package/llms/components/obc-advice-button.md +87 -0
- package/llms/components/obc-advice-floating-item.md +113 -0
- package/llms/components/obc-advice-menu-item.md +87 -0
- package/llms/components/obc-advice-message-item.md +138 -0
- package/llms/components/obc-alert-button-item.md +117 -0
- package/llms/components/obc-alert-button.md +134 -0
- package/llms/components/obc-alert-counter-item.md +74 -0
- package/llms/components/obc-alert-detail-page.md +45 -0
- package/llms/components/obc-alert-floating-item.md +53 -0
- package/llms/components/obc-alert-frame.md +142 -0
- package/llms/components/obc-alert-icon.md +79 -0
- package/llms/components/obc-alert-list-details-experimental.md +89 -0
- package/llms/components/obc-alert-list-details.md +38 -0
- package/llms/components/obc-alert-list-page-small.md +39 -0
- package/llms/components/obc-alert-list.md +37 -0
- package/llms/components/obc-alert-menu-item.md +128 -0
- package/llms/components/obc-alert-menu.md +115 -0
- package/llms/components/obc-alert-subsystem-button.md +88 -0
- package/llms/components/obc-alert-subsystem-counter.md +110 -0
- package/llms/components/obc-analog-threeway-valve.md +106 -0
- package/llms/components/obc-analog-valve.md +74 -0
- package/llms/components/obc-app-button.md +83 -0
- package/llms/components/obc-app-menu.md +69 -0
- package/llms/components/obc-area-graph.md +333 -0
- package/llms/components/obc-attachment-list-item.md +49 -0
- package/llms/components/obc-audio-output.md +59 -0
- package/llms/components/obc-audio-recording-item.md +91 -0
- package/llms/components/obc-automation-badge.md +66 -0
- package/llms/components/obc-automation-button-readout-stack.md +71 -0
- package/llms/components/obc-automation-button.md +86 -0
- package/llms/components/obc-automation-input-modal.md +48 -0
- package/llms/components/obc-automation-readout.md +32 -0
- package/llms/components/obc-automation-tank.md +156 -0
- package/llms/components/obc-azimuth-thruster-labeled.md +56 -0
- package/llms/components/obc-azimuth-thruster.md +80 -0
- package/llms/components/obc-badge-command.md +26 -0
- package/llms/components/obc-badge.md +151 -0
- package/llms/components/obc-bar-horizontal.md +123 -0
- package/llms/components/obc-bar-vertical.md +125 -0
- package/llms/components/obc-battery-icon.md +38 -0
- package/llms/components/obc-bearing-indicator.md +27 -0
- package/llms/components/obc-bipolar-transistor.md +64 -0
- package/llms/components/obc-breadcrumb.md +58 -0
- package/llms/components/obc-brilliance-menu.md +115 -0
- package/llms/components/obc-bus.md +64 -0
- package/llms/components/obc-button.md +110 -0
- package/llms/components/obc-calendar.md +91 -0
- package/llms/components/obc-capacitor.md +64 -0
- package/llms/components/obc-card.md +103 -0
- package/llms/components/obc-chart-object-vessel-button.md +103 -0
- package/llms/components/obc-chat-message.md +35 -0
- package/llms/components/obc-check-button.md +104 -0
- package/llms/components/obc-checkbox-item.md +95 -0
- package/llms/components/obc-checkbox-list.md +73 -0
- package/llms/components/obc-checkbox.md +97 -0
- package/llms/components/obc-circular-progress.md +36 -0
- package/llms/components/obc-clock.md +86 -0
- package/llms/components/obc-command-button.md +56 -0
- package/llms/components/obc-command-menu.md +135 -0
- package/llms/components/obc-communication-table.md +31 -0
- package/llms/components/obc-compass-flat.md +79 -0
- package/llms/components/obc-compass-indicator.md +61 -0
- package/llms/components/obc-compass-sector.md +110 -0
- package/llms/components/obc-compass.md +157 -0
- package/llms/components/obc-context-menu-input.md +191 -0
- package/llms/components/obc-converter.md +64 -0
- package/llms/components/obc-corner-line.md +29 -0
- package/llms/components/obc-current.md +79 -0
- package/llms/components/obc-damper.md +62 -0
- package/llms/components/obc-date-item.md +66 -0
- package/llms/components/obc-depth-actual.md +69 -0
- package/llms/components/obc-depth-indicator.md +31 -0
- package/llms/components/obc-depth-top-band.md +43 -0
- package/llms/components/obc-depth.md +94 -0
- package/llms/components/obc-diagnostic-button.md +71 -0
- package/llms/components/obc-diagnostic-menu.md +88 -0
- package/llms/components/obc-digital-threeway-valve.md +112 -0
- package/llms/components/obc-digital-valve.md +78 -0
- package/llms/components/obc-diodes.md +64 -0
- package/llms/components/obc-direction-line.md +28 -0
- package/llms/components/obc-divider.md +44 -0
- package/llms/components/obc-donut-chart.md +116 -0
- package/llms/components/obc-draft-trim.md +67 -0
- package/llms/components/obc-dropdown-button.md +99 -0
- package/llms/components/obc-electricity-battery.md +83 -0
- package/llms/components/obc-elevated-card-radio-group.md +103 -0
- package/llms/components/obc-elevated-card-radio.md +104 -0
- package/llms/components/obc-elevated-card.md +146 -0
- package/llms/components/obc-end-point-line.md +29 -0
- package/llms/components/obc-event-item.md +47 -0
- package/llms/components/obc-event-list.md +37 -0
- package/llms/components/obc-fan.md +68 -0
- package/llms/components/obc-filter-chip.md +91 -0
- package/llms/components/obc-filter.md +64 -0
- package/llms/components/obc-floating-item.md +125 -0
- package/llms/components/obc-form-container.md +45 -0
- package/llms/components/obc-form-footer-container.md +34 -0
- package/llms/components/obc-form-group.md +80 -0
- package/llms/components/obc-form-item.md +95 -0
- package/llms/components/obc-gauge-bar-indicator.md +46 -0
- package/llms/components/obc-gauge-generator.md +102 -0
- package/llms/components/obc-gauge-horizontal.md +169 -0
- package/llms/components/obc-gauge-motors-and-pumps.md +110 -0
- package/llms/components/obc-gauge-proportional.md +134 -0
- package/llms/components/obc-gauge-radial-indicator.md +76 -0
- package/llms/components/obc-gauge-radial.md +163 -0
- package/llms/components/obc-gauge-trend-indicator.md +53 -0
- package/llms/components/obc-gauge-trend.md +271 -0
- package/llms/components/obc-gauge-valve.md +114 -0
- package/llms/components/obc-gauge-vertical.md +169 -0
- package/llms/components/obc-gnss-skyplot.md +80 -0
- package/llms/components/obc-graph-mini.md +28 -0
- package/llms/components/obc-ground.md +64 -0
- package/llms/components/obc-heading-indicator.md +42 -0
- package/llms/components/obc-heading.md +106 -0
- package/llms/components/obc-heat-exchanger.md +80 -0
- package/llms/components/obc-heat-pump.md +79 -0
- package/llms/components/obc-heave-indicator.md +38 -0
- package/llms/components/obc-heave.md +60 -0
- package/llms/components/obc-horizontal-line.md +29 -0
- package/llms/components/obc-hydraulic-check-valve.md +36 -0
- package/llms/components/obc-hydraulic-separator.md +80 -0
- package/llms/components/obc-hydraulic-valve-4-3.md +71 -0
- package/llms/components/obc-hydraulic-valve-x-2.md +68 -0
- package/llms/components/obc-icon-button.md +117 -0
- package/llms/components/obc-icon-check-button.md +85 -0
- package/llms/components/obc-indicator-battery.md +69 -0
- package/llms/components/obc-indicator-engine.md +39 -0
- package/llms/components/obc-indicator-generator.md +59 -0
- package/llms/components/obc-indicator-graph.md +33 -0
- package/llms/components/obc-indicator-tank-atmospheric.md +69 -0
- package/llms/components/obc-input-chip.md +96 -0
- package/llms/components/obc-instrument-field.md +172 -0
- package/llms/components/obc-instrument-radial.md +77 -0
- package/llms/components/obc-integration-app-bar.md +41 -0
- package/llms/components/obc-integration-bar-dropdown.md +71 -0
- package/llms/components/obc-integration-bar.md +72 -0
- package/llms/components/obc-integration-button.md +62 -0
- package/llms/components/obc-integration-dropdown-button.md +75 -0
- package/llms/components/obc-integration-fleet-button.md +41 -0
- package/llms/components/obc-integration-tabs.md +28 -0
- package/llms/components/obc-integration-vessel-menu.md +58 -0
- package/llms/components/obc-integration-vessel-selector.md +32 -0
- package/llms/components/obc-keyboard-full.md +175 -0
- package/llms/components/obc-keyboard-numeric.md +77 -0
- package/llms/components/obc-line-cross.md +28 -0
- package/llms/components/obc-line-graph.md +164 -0
- package/llms/components/obc-line-overlap.md +28 -0
- package/llms/components/obc-logic.md +64 -0
- package/llms/components/obc-main-engine-indicator.md +55 -0
- package/llms/components/obc-main-engine.md +54 -0
- package/llms/components/obc-menu-button.md +158 -0
- package/llms/components/obc-message-menu-item.md +165 -0
- package/llms/components/obc-modal-window.md +139 -0
- package/llms/components/obc-mosfet.md +64 -0
- package/llms/components/obc-motor.md +73 -0
- package/llms/components/obc-navigation-item-group.md +82 -0
- package/llms/components/obc-navigation-item.md +138 -0
- package/llms/components/obc-navigation-menu.md +135 -0
- package/llms/components/obc-non-return-valve.md +79 -0
- package/llms/components/obc-notification-badge-button.md +87 -0
- package/llms/components/obc-notification-button.md +92 -0
- package/llms/components/obc-notification-floating-item.md +121 -0
- package/llms/components/obc-notification-menu-item.md +87 -0
- package/llms/components/obc-notification-message-item.md +127 -0
- package/llms/components/obc-number-input-field.md +97 -0
- package/llms/components/obc-pagination.md +95 -0
- package/llms/components/obc-pie-chart.md +120 -0
- package/llms/components/obc-pitch-indicator.md +39 -0
- package/llms/components/obc-pitch-roll-heave.md +86 -0
- package/llms/components/obc-pitch-roll-yaw.md +72 -0
- package/llms/components/obc-pitch-roll.md +63 -0
- package/llms/components/obc-pitch.md +81 -0
- package/llms/components/obc-pivot-item-group.md +79 -0
- package/llms/components/obc-pivot-item.md +75 -0
- package/llms/components/obc-poi-aton.md +68 -0
- package/llms/components/obc-poi-button-aton.md +54 -0
- package/llms/components/obc-poi-button-data.md +53 -0
- package/llms/components/obc-poi-button-vessel.md +55 -0
- package/llms/components/obc-poi-button.md +94 -0
- package/llms/components/obc-poi-card-header.md +90 -0
- package/llms/components/obc-poi-card.md +110 -0
- package/llms/components/obc-poi-controller.md +151 -0
- package/llms/components/obc-poi-data.md +72 -0
- package/llms/components/obc-poi-graphic-line.md +70 -0
- package/llms/components/obc-poi-group.md +85 -0
- package/llms/components/obc-poi-header.md +71 -0
- package/llms/components/obc-poi-layer-stack.md +85 -0
- package/llms/components/obc-poi-layer.md +110 -0
- package/llms/components/obc-poi-line.md +70 -0
- package/llms/components/obc-poi-object-aton.md +45 -0
- package/llms/components/obc-poi-object-data.md +48 -0
- package/llms/components/obc-poi-object-vessel.md +95 -0
- package/llms/components/obc-poi-object.md +82 -0
- package/llms/components/obc-poi-pointer.md +70 -0
- package/llms/components/obc-poi-selection-frame.md +66 -0
- package/llms/components/obc-poi-vessel.md +70 -0
- package/llms/components/obc-poi.md +140 -0
- package/llms/components/obc-polar-chart.md +126 -0
- package/llms/components/obc-position-deviation.md +84 -0
- package/llms/components/obc-pressure-reduction-valve.md +88 -0
- package/llms/components/obc-pressure-sustain-valve.md +85 -0
- package/llms/components/obc-progress-bar.md +102 -0
- package/llms/components/obc-progress-button.md +111 -0
- package/llms/components/obc-progress-indicator-dots.md +57 -0
- package/llms/components/obc-propulsion-azimuth-indicator.md +48 -0
- package/llms/components/obc-pump.md +76 -0
- package/llms/components/obc-radial-bar-chart.md +103 -0
- package/llms/components/obc-radio.md +82 -0
- package/llms/components/obc-rate-of-turn.md +95 -0
- package/llms/components/obc-readout-block.md +137 -0
- package/llms/components/obc-readout-list-item.md +142 -0
- package/llms/components/obc-readout-list.md +85 -0
- package/llms/components/obc-readout.md +169 -0
- package/llms/components/obc-resistor.md +64 -0
- package/llms/components/obc-rich-button.md +92 -0
- package/llms/components/obc-roll-indicator.md +38 -0
- package/llms/components/obc-roll.md +56 -0
- package/llms/components/obc-rot-indicator.md +32 -0
- package/llms/components/obc-rot-linear.md +68 -0
- package/llms/components/obc-rot-sector.md +125 -0
- package/llms/components/obc-router.md +64 -0
- package/llms/components/obc-rudder-indicator.md +54 -0
- package/llms/components/obc-rudder.md +112 -0
- package/llms/components/obc-ruler-pointer.md +57 -0
- package/llms/components/obc-scrollbar.md +57 -0
- package/llms/components/obc-sequence-card.md +119 -0
- package/llms/components/obc-sequence-connector.md +70 -0
- package/llms/components/obc-sequence-item.md +64 -0
- package/llms/components/obc-sequence-loading-spinner.md +70 -0
- package/llms/components/obc-sequence-modal.md +89 -0
- package/llms/components/obc-sequence-step.md +48 -0
- package/llms/components/obc-sequence-toolbar.md +108 -0
- package/llms/components/obc-slide-button.md +111 -0
- package/llms/components/obc-slider-double.md +137 -0
- package/llms/components/obc-slider.md +143 -0
- package/llms/components/obc-source.md +64 -0
- package/llms/components/obc-speed-arrows.md +39 -0
- package/llms/components/obc-speed-directions.md +66 -0
- package/llms/components/obc-speed-gauge.md +124 -0
- package/llms/components/obc-speed-indicator.md +37 -0
- package/llms/components/obc-split-button.md +144 -0
- package/llms/components/obc-start-stop-switch.md +126 -0
- package/llms/components/obc-status-indicator.md +30 -0
- package/llms/components/obc-stepper-box.md +90 -0
- package/llms/components/obc-surge-sway-yaw.md +95 -0
- package/llms/components/obc-switch.md +69 -0
- package/llms/components/obc-system-button.md +112 -0
- package/llms/components/obc-system-menu.md +67 -0
- package/llms/components/obc-tab-item.md +161 -0
- package/llms/components/obc-tab-row.md +151 -0
- package/llms/components/obc-tabbed-card.md +148 -0
- package/llms/components/obc-table-header-item.md +42 -0
- package/llms/components/obc-table.md +124 -0
- package/llms/components/obc-tag.md +41 -0
- package/llms/components/obc-text-input-field.md +94 -0
- package/llms/components/obc-textarea-field.md +186 -0
- package/llms/components/obc-textbox.md +80 -0
- package/llms/components/obc-three-way-line.md +29 -0
- package/llms/components/obc-thruster.md +64 -0
- package/llms/components/obc-title-container.md +81 -0
- package/llms/components/obc-toggle-button-group.md +184 -0
- package/llms/components/obc-toggle-button-option.md +126 -0
- package/llms/components/obc-toggle-button-three-state.md +38 -0
- package/llms/components/obc-toggle-button-vertical-group.md +142 -0
- package/llms/components/obc-toggle-button-vertical-option.md +110 -0
- package/llms/components/obc-toggle-switch.md +126 -0
- package/llms/components/obc-toggletip.md +135 -0
- package/llms/components/obc-tooltip.md +106 -0
- package/llms/components/obc-top-bar.md +194 -0
- package/llms/components/obc-top-view-propulsion.md +84 -0
- package/llms/components/obc-topbar-message-item.md +150 -0
- package/llms/components/obc-transformer.md +64 -0
- package/llms/components/obc-transmitter-button.md +101 -0
- package/llms/components/obc-transmitter-stack.md +79 -0
- package/llms/components/obc-transmitter.md +114 -0
- package/llms/components/obc-tree-navigation-group.md +69 -0
- package/llms/components/obc-tree-navigation-item.md +110 -0
- package/llms/components/obc-tree-navigation.md +73 -0
- package/llms/components/obc-tunnel-thruster.md +59 -0
- package/llms/components/obc-user-button.md +107 -0
- package/llms/components/obc-user-menu.md +154 -0
- package/llms/components/obc-valve-analog-three-way-icon.md +69 -0
- package/llms/components/obc-valve-analog-two-way-icon.md +39 -0
- package/llms/components/obc-velocity-projection-plot.md +34 -0
- package/llms/components/obc-vendor-button.md +63 -0
- package/llms/components/obc-vertical-line.md +33 -0
- package/llms/components/obc-watch-flat.md +54 -0
- package/llms/components/obc-watch.md +206 -0
- package/llms/components/obc-wind-indicator.md +52 -0
- package/llms/components/obc-wind-propulsion.md +92 -0
- package/llms/components/obc-wind.md +46 -0
- package/llms/docs/ar-poi-projection.md +36 -0
- package/llms/docs/automation-sequence-step-diagram-playground.md +13 -0
- package/llms/docs/building-blocks-advice.md +31 -0
- package/llms/docs/building-blocks-external-scale.md +138 -0
- package/llms/docs/building-blocks-setpoint.md +119 -0
- package/llms/docs/introduction-advice-system.md +161 -0
- package/llms/docs/introduction-getting-started.md +94 -0
- package/llms/docs/introduction-introduction.md +27 -0
- package/llms/docs/introduction-join-the-project.md +11 -0
- package/llms/docs/introduction-migration-guide-2-0-to-2-1.md +126 -0
- package/llms/docs/introduction-migration-guide-2-1-to-2-2.md +106 -0
- package/llms/docs/introduction-migration-guide.md +1063 -0
- package/llms/docs/palettes-categorical-colour.md +9 -0
- package/llms/llms-full.txt +28380 -0
- package/llms/llms.txt +368 -0
- package/package.json +12 -2
- package/script/cem-plugins/lifecycle.d.mts +6 -0
- package/script/cem-plugins/lifecycle.mjs +48 -0
- package/script/cem-plugins.test.ts +52 -1
- package/script/generate-llms-txt.ts +34 -0
- package/script/llms/channel.test.ts +69 -0
- package/script/llms/channel.ts +63 -0
- package/script/llms/generate.test.ts +143 -0
- package/script/llms/generate.ts +229 -0
- package/script/llms/manifest.test.ts +160 -0
- package/script/llms/manifest.ts +109 -0
- package/script/llms/markdown.test.ts +22 -0
- package/script/llms/markdown.ts +37 -0
- package/script/llms/mdx.test.ts +172 -0
- package/script/llms/mdx.ts +171 -0
- package/script/llms/render-component.test.ts +290 -0
- package/script/llms/render-component.ts +208 -0
- package/script/llms/render-guides.test.ts +105 -0
- package/script/llms/render-guides.ts +51 -0
- package/script/llms/render-llms-txt.test.ts +222 -0
- package/script/llms/render-llms-txt.ts +185 -0
- package/script/llms/sources.test.ts +118 -0
- package/script/llms/sources.ts +89 -0
- package/script/llms/stories.test.ts +193 -0
- package/script/llms/stories.ts +256 -0
- package/script/llms/types.ts +95 -0
- package/script/prepare-full-bundle.ts +1 -0
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
# `<obc-toggle-button-option>`
|
|
2
|
+
|
|
3
|
+
A single selectable option within a toggle button group.
|
|
4
|
+
|
|
5
|
+
Lifecycle: stable. [Source](https://raw.githubusercontent.com/Ocean-Industries-Concept-Lab/openbridge-webcomponents/develop/packages/openbridge-webcomponents/src/components/toggle-button-option/toggle-button-option.ts)
|
|
6
|
+
|
|
7
|
+
`<obc-toggle-button-option>` – A single selectable option within a toggle button group.
|
|
8
|
+
|
|
9
|
+
Represents an individual button option within an `<obc-toggle-button-group>`. This component should not
|
|
10
|
+
be used standalone; it is designed to function exclusively as a child element of a toggle button group,
|
|
11
|
+
which manages selection state and interaction logic.
|
|
12
|
+
|
|
13
|
+
The option renders as a button with flexible content layouts (text, icon, or both) and provides visual
|
|
14
|
+
feedback for selection, activation, and disabled states. All styling properties (type, variant, size)
|
|
15
|
+
are typically propagated from the parent group to ensure visual consistency across all options.
|
|
16
|
+
|
|
17
|
+
## Features
|
|
18
|
+
|
|
19
|
+
- **Selection state:** Displays a distinct visual style when selected, controlled by the parent group.
|
|
20
|
+
Only one option in a group can be selected at a time.
|
|
21
|
+
- **Activation state:** Shows temporary visual feedback when clicked, useful in external control scenarios
|
|
22
|
+
where the parent manages state updates asynchronously (e.g., waiting for API confirmation).
|
|
23
|
+
**TODO(designer)** – Clarify the exact visual difference between `activated` and `selected` states and when developers should use activation.
|
|
24
|
+
- **Disabled state:** Can be individually disabled while other options in the group remain interactive.
|
|
25
|
+
When disabled, the option is visually dimmed and does not respond to clicks. The parent group will skip
|
|
26
|
+
over disabled options when determining fallback selections.
|
|
27
|
+
- **Flexible content layouts:**
|
|
28
|
+
- `text`: Text label only (default).
|
|
29
|
+
- `icon`: Icon only (compact, ideal for limited space).
|
|
30
|
+
- `iconText`: Icon and text side-by-side.
|
|
31
|
+
- `iconTextUnder`: Icon stacked above text label.
|
|
32
|
+
- **Divider handling:** Supports automatic divider rendering between options. The `showDivider` property is
|
|
33
|
+
managed by the parent group to hide dividers after the selected option for a cohesive appearance.
|
|
34
|
+
- **Size variants:** Standard and large sizes supported via the `large` property for improved touch targets
|
|
35
|
+
and accessibility.
|
|
36
|
+
|
|
37
|
+
## Usage Guidelines
|
|
38
|
+
|
|
39
|
+
**Always use `<obc-toggle-button-option>` as a child of `<obc-toggle-button-group>`.** The parent group
|
|
40
|
+
handles all selection logic, event coordination, and style propagation. Using this component outside a
|
|
41
|
+
group will result in non-functional behavior.
|
|
42
|
+
|
|
43
|
+
**Ideal use cases:**
|
|
44
|
+
- As a building block for view toggles (list/grid/chart)
|
|
45
|
+
- As filter options within a segmented control
|
|
46
|
+
- As mode selectors in toolbars or control panels
|
|
47
|
+
|
|
48
|
+
**Best Practices:**
|
|
49
|
+
- Assign a unique `value` to each option in the group to enable proper selection tracking.
|
|
50
|
+
- Use the default slot for text labels (short, descriptive text: 1-2 words ideal).
|
|
51
|
+
- Use the `icon` slot for icon content when the parent group's `type` includes icons.
|
|
52
|
+
- Avoid manually setting `type`, `variant`, `hugText`, or `large` properties; let the parent group propagate these for consistency.
|
|
53
|
+
- For icon-only options, ensure icons are universally understandable or provide tooltips for accessibility.
|
|
54
|
+
- Use the `disabled` property sparingly; if all options are disabled, consider disabling the entire group instead.
|
|
55
|
+
|
|
56
|
+
**When not to use:**
|
|
57
|
+
- Do not use this component standalone without a parent `<obc-toggle-button-group>`.
|
|
58
|
+
- Do not use for multi-select scenarios (use checkboxes or chips instead).
|
|
59
|
+
- Do not use for standalone action buttons (use `<obc-button>` or similar instead).
|
|
60
|
+
|
|
61
|
+
## Slots
|
|
62
|
+
|
|
63
|
+
| Slot Name | Renders When... | Purpose |
|
|
64
|
+
|-----------|-----------------|---------|
|
|
65
|
+
| (default) | When `type` is `text`, `iconText`, or `iconTextUnder` | Text label content for the option. Keep concise (1-2 words). |
|
|
66
|
+
| icon | When `type` is `icon`, `iconText`, or `iconTextUnder` | Icon content for the option. Use OpenBridge icons like `<obi-placeholder>` or `<obi-search>`. |
|
|
67
|
+
|
|
68
|
+
## Events
|
|
69
|
+
|
|
70
|
+
- `selected` – Fired when the option is clicked and is not already selected. The parent group listens to
|
|
71
|
+
this event to update selection state. Event detail: `{ value: string }`.
|
|
72
|
+
|
|
73
|
+
## Example
|
|
74
|
+
|
|
75
|
+
```html
|
|
76
|
+
<!-- Used within a toggle button group -->
|
|
77
|
+
<obc-toggle-button-group value="list" type="iconText">
|
|
78
|
+
<obc-toggle-button-option value="list">
|
|
79
|
+
<obi-placeholder slot="icon"></obi-placeholder>
|
|
80
|
+
List
|
|
81
|
+
</obc-toggle-button-option>
|
|
82
|
+
<obc-toggle-button-option value="grid">
|
|
83
|
+
<obi-placeholder slot="icon"></obi-placeholder>
|
|
84
|
+
Grid
|
|
85
|
+
</obc-toggle-button-option>
|
|
86
|
+
<obc-toggle-button-option value="chart" disabled>
|
|
87
|
+
<obi-placeholder slot="icon"></obi-placeholder>
|
|
88
|
+
Chart
|
|
89
|
+
</obc-toggle-button-option>
|
|
90
|
+
</obc-toggle-button-group>
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Keyboard
|
|
94
|
+
One option of the [APG Radio Group](https://www.w3.org/WAI/ARIA/apg/patterns/radio/)
|
|
95
|
+
that `obc-toggle-button-group` renders: the group owns the single tab stop
|
|
96
|
+
and the arrow keys, and `Enter` or `Space` selects the option.
|
|
97
|
+
|
|
98
|
+
Left out: nothing at the option level.
|
|
99
|
+
|
|
100
|
+
## Properties
|
|
101
|
+
|
|
102
|
+
| Property | Attribute | Type | Default | Description |
|
|
103
|
+
| --- | --- | --- | --- | --- |
|
|
104
|
+
| value | value | `string` | `'value'` | Value associated with this option. Used in selection events. |
|
|
105
|
+
| selected | selected | `boolean` | `false` | Whether this option is currently selected (toggles visual state). |
|
|
106
|
+
| activated | activated | `boolean` | `false` | Whether this option is currently activated (toggles visual state). |
|
|
107
|
+
| type | type | | | Layout of icon and label. One of: "icon", "text", "icon-text-under", "text-icon". Controls which slots/content are displayed and their arrangement. |
|
|
108
|
+
| variant | variant | | | The visual variant of the toggle button option. One of: "flat", "regular", "normal". |
|
|
109
|
+
| hugText | hugText | `boolean` | `false` | If true, button width shrinks to fit label content. Available when `type!=icon-text-under`. |
|
|
110
|
+
| showDivider | showDivider | `boolean` | `true` | If true, renders the divider between options. |
|
|
111
|
+
| disabled | disabled | `boolean` | `false` | If true, the option is disabled and cannot be interacted with. |
|
|
112
|
+
| large | large | `boolean` | `false` | If true, the option uses a larger size. Available when `type!=icon-text-under`. |
|
|
113
|
+
| focusable | | `boolean` | `true` | Whether the option is in the tab order. `obc-toggle-button-group` manages this as a roving tabindex (one option focusable at a time); a standalone option stays tabbable. |
|
|
114
|
+
|
|
115
|
+
## Events
|
|
116
|
+
|
|
117
|
+
| Event | Type | Description |
|
|
118
|
+
| --- | --- | --- |
|
|
119
|
+
| selected | `CustomEvent<{value: string}>` | Fired when the option is clicked and not already selected. |
|
|
120
|
+
|
|
121
|
+
## Slots
|
|
122
|
+
|
|
123
|
+
| Slot | Description |
|
|
124
|
+
| --- | --- |
|
|
125
|
+
| (default) | Text label content for the option (when type includes text). |
|
|
126
|
+
| icon | Icon content for the option (when type includes icons). |
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# `<obc-toggle-button-three-state>`
|
|
2
|
+
|
|
3
|
+
A three-state segmented control for no input, success, and error.
|
|
4
|
+
|
|
5
|
+
Lifecycle: beta. [Storybook](https://openbridge-next-storybook.web.app/?path=/docs/ui-components-selection-controls-and-switches-toggle-button-three-state--docs) · [Source](https://raw.githubusercontent.com/Ocean-Industries-Concept-Lab/openbridge-webcomponents/develop/packages/openbridge-webcomponents/src/components/toggle-button-three-state/toggle-button-three-state.ts)
|
|
6
|
+
|
|
7
|
+
`<obc-toggle-button-three-state>` – A three-state segmented control for no input, success, and error.
|
|
8
|
+
|
|
9
|
+
Provides a fixed three-option toggle with icon-only segments:
|
|
10
|
+
- Error (X)
|
|
11
|
+
- No input (dot)
|
|
12
|
+
- Success (check)
|
|
13
|
+
|
|
14
|
+
The component manages its own `state` and emits a `change` event when the
|
|
15
|
+
selection changes. Use `disabled` to make it non-interactive.
|
|
16
|
+
|
|
17
|
+
## Properties
|
|
18
|
+
|
|
19
|
+
| Property | Attribute | Type | Default | Description |
|
|
20
|
+
| --- | --- | --- | --- | --- |
|
|
21
|
+
| state | state | `ObcToggleButtonThreeStateValue` | | Current state of the toggle. |
|
|
22
|
+
| disabled | disabled | `boolean` | `false` | Disables interaction when true. |
|
|
23
|
+
|
|
24
|
+
## Events
|
|
25
|
+
|
|
26
|
+
| Event | Type | Description |
|
|
27
|
+
| --- | --- | --- |
|
|
28
|
+
| change | `ObcToggleButtonThreeStateChangeEvent` | Fired when the state changes. |
|
|
29
|
+
|
|
30
|
+
## Slots
|
|
31
|
+
|
|
32
|
+
None.
|
|
33
|
+
|
|
34
|
+
## Stories
|
|
35
|
+
|
|
36
|
+
- [No Input](https://openbridge-next-storybook.web.app/?path=/story/ui-components-selection-controls-and-switches-toggle-button-three-state--no-input)
|
|
37
|
+
- [Success](https://openbridge-next-storybook.web.app/?path=/story/ui-components-selection-controls-and-switches-toggle-button-three-state--success)
|
|
38
|
+
- [Error State](https://openbridge-next-storybook.web.app/?path=/story/ui-components-selection-controls-and-switches-toggle-button-three-state--error-state)
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
# `<obc-toggle-button-vertical-group>`
|
|
2
|
+
|
|
3
|
+
A vertically oriented segmented control for selecting a single option from a set.
|
|
4
|
+
|
|
5
|
+
Lifecycle: stable. [Storybook](https://openbridge-next-storybook.web.app/?path=/docs/ui-components-selection-controls-and-switches-toggle-button-vertical--docs) · [Source](https://raw.githubusercontent.com/Ocean-Industries-Concept-Lab/openbridge-webcomponents/develop/packages/openbridge-webcomponents/src/components/toggle-button-vertical-group/toggle-button-vertical-group.ts)
|
|
6
|
+
|
|
7
|
+
`<obc-toggle-button-vertical-group>` – A vertically oriented segmented control for selecting a single option from a set.
|
|
8
|
+
|
|
9
|
+
Provides a vertical stack of connected toggle buttons where only one option can be selected at a time.
|
|
10
|
+
Each option is represented by an `<obc-toggle-button-vertical-option>` child element. The group manages selection
|
|
11
|
+
state automatically, deselecting the previous option when a new one is chosen.
|
|
12
|
+
|
|
13
|
+
Appears as a visually unified vertical column of buttons with clear selection indicators. Commonly used for sidebar
|
|
14
|
+
navigation, vertical filter controls, or mode selection in vertical layouts. Ideal for scenarios where vertical
|
|
15
|
+
space is available and horizontal space is limited, such as side panels or navigation drawers.
|
|
16
|
+
|
|
17
|
+
## Features
|
|
18
|
+
|
|
19
|
+
- **Single selection mode:** Only one option can be active at a time; selecting a new option automatically
|
|
20
|
+
deselects the previous one. Similar to radio button behavior but with a button-like vertical appearance.
|
|
21
|
+
- **Visual variants:**
|
|
22
|
+
- `regular` (default): Standard appearance with full background and border styling.
|
|
23
|
+
- `flat`: Minimal style with reduced visual weight, no prominent background or border.
|
|
24
|
+
- `normal`: **TODO(designer)** – Clarify the visual difference and intended use case for the `normal` variant compared to `regular` and `flat`.
|
|
25
|
+
- **Layout behavior:**
|
|
26
|
+
- By default, the group stretches to fill available container width, with options stacked vertically.
|
|
27
|
+
- When `hugWidth` is true, the group shrinks to fit its content width instead of expanding.
|
|
28
|
+
- **Empty selection mode:** When `allowEmptySelection` is true, a `value` that does not match any enabled
|
|
29
|
+
option leaves the group with no option selected, instead of defaulting to the first enabled option. Use
|
|
30
|
+
this when a selection may legitimately be absent (e.g. unset, loading, or error states) so the UI does not
|
|
31
|
+
imply a choice the user has not made.
|
|
32
|
+
- **Disabled state:** Setting `disabled` on the group disables all contained options at once. Individual
|
|
33
|
+
options can also be disabled independently while the group remains enabled.
|
|
34
|
+
- **Divider management:** Automatically shows visual dividers between options and hides the divider after
|
|
35
|
+
the last option for a clean, unified appearance.
|
|
36
|
+
- **Property propagation:** The group automatically synchronizes the `type` property to all child
|
|
37
|
+
`<obc-toggle-button-vertical-option>` elements for consistent styling.
|
|
38
|
+
- **Automatic fallback selection:** If the current value is set to a disabled or non-existent option, the
|
|
39
|
+
group automatically selects the first enabled option to ensure a valid state.
|
|
40
|
+
|
|
41
|
+
## Usage Guidelines
|
|
42
|
+
|
|
43
|
+
Use `<obc-toggle-button-vertical-group>` when you need users to choose exactly one option from a small set of
|
|
44
|
+
mutually exclusive choices (typically 2-5 options) in a vertical layout. It provides a more compact and visually
|
|
45
|
+
integrated alternative to radio buttons for vertical navigation or control panels.
|
|
46
|
+
|
|
47
|
+
**Ideal use cases:**
|
|
48
|
+
- Sidebar navigation toggles (e.g., dashboard/reports/settings views)
|
|
49
|
+
- Vertical filter controls (e.g., all/active/archived items)
|
|
50
|
+
- Mode selectors in vertical panels (e.g., edit/preview/code modes)
|
|
51
|
+
- View toggles in constrained horizontal spaces (e.g., mobile side panels)
|
|
52
|
+
- Control panels with vertical layout preference
|
|
53
|
+
|
|
54
|
+
**When not to use:**
|
|
55
|
+
- For binary on/off choices, use a switch or checkbox instead.
|
|
56
|
+
- For multiple selections from a set, use checkboxes or chips.
|
|
57
|
+
- For many options (6+), consider a dropdown/select or radio button list for better scannability.
|
|
58
|
+
- For horizontal layouts with adequate space, use `<obc-toggle-button-group>` instead.
|
|
59
|
+
- For navigation between pages or sections, use tabs or a navigation menu.
|
|
60
|
+
|
|
61
|
+
**Best Practices:**
|
|
62
|
+
- Each option must have a unique `value` property to prevent selection conflicts.
|
|
63
|
+
- Provide clear, concise labels for each option. Keep text short (1-2 words ideal).
|
|
64
|
+
- For icon-only buttons, ensure icons are universally recognizable or provide tooltips.
|
|
65
|
+
- Set an initial `value` to indicate the default selection, or the first enabled option will be selected automatically.
|
|
66
|
+
- Avoid disabling the currently selected option; if an option becomes unavailable, selection will shift to the first enabled option.
|
|
67
|
+
- Use `type="flat"` in dense UIs or when the toggle is secondary to other content.
|
|
68
|
+
- Ensure adequate vertical space for the number of options to avoid excessive scrolling or cramped layouts.
|
|
69
|
+
|
|
70
|
+
## Slots
|
|
71
|
+
|
|
72
|
+
| Slot Name | Renders When... | Purpose |
|
|
73
|
+
|-----------|-----------------|---------|
|
|
74
|
+
| (default) | Always | Place one or more `<obc-toggle-button-vertical-option>` elements here to define the selectable options in the group. Each option can include an icon via its own `icon` slot. |
|
|
75
|
+
|
|
76
|
+
## Events
|
|
77
|
+
|
|
78
|
+
- `value` – Fired when the selected value changes, either through user interaction or programmatic change.
|
|
79
|
+
Event detail: `{ value: string, previousValue: string }`. Listen to this event to react to selection changes.
|
|
80
|
+
|
|
81
|
+
## Example
|
|
82
|
+
|
|
83
|
+
```html
|
|
84
|
+
<obc-toggle-button-vertical-group value="list" type="regular">
|
|
85
|
+
<obc-toggle-button-vertical-option value="list" label="List" hasIcon>
|
|
86
|
+
<obi-placeholder slot="icon"></obi-placeholder>
|
|
87
|
+
</obc-toggle-button-vertical-option>
|
|
88
|
+
<obc-toggle-button-vertical-option value="grid" label="Grid" hasIcon>
|
|
89
|
+
<obi-placeholder slot="icon"></obi-placeholder>
|
|
90
|
+
</obc-toggle-button-vertical-option>
|
|
91
|
+
<obc-toggle-button-vertical-option value="table" label="Table" hasIcon>
|
|
92
|
+
<obi-placeholder slot="icon"></obi-placeholder>
|
|
93
|
+
</obc-toggle-button-vertical-option>
|
|
94
|
+
</obc-toggle-button-vertical-group>
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## Properties
|
|
98
|
+
|
|
99
|
+
| Property | Attribute | Type | Default | Description |
|
|
100
|
+
| --- | --- | --- | --- | --- |
|
|
101
|
+
| value | value | `string` | `''` | The value of the currently selected option. Setting this property programmatically updates the selection. If the value does not match any enabled option, the group selects the first available enabled option. |
|
|
102
|
+
| type | type | | | Visual style for all options in the group. One of: "flat", "regular", "normal". |
|
|
103
|
+
| hugWidth | hugWidth | `boolean` | `false` | If true, the group shrinks to fit its content width instead of stretching to fill its container. Defaults to false. |
|
|
104
|
+
| allowEmptySelection | allowEmptySelection | `boolean` | `false` | Lets the group hold no selection: a `value` matching no enabled option, or a selected option that becomes disabled, clears the selection instead of falling back to the first enabled option. |
|
|
105
|
+
| disabled | disabled | `boolean` | `false` | Disables the entire group and all contained options. When set to true, all options become non-interactive, regardless of their individual disabled state. Defaults to false. |
|
|
106
|
+
|
|
107
|
+
## Events
|
|
108
|
+
|
|
109
|
+
| Event | Type | Description |
|
|
110
|
+
| --- | --- | --- |
|
|
111
|
+
| value | `CustomEvent<{value: string, previousValue: string}>` | Fired when the selected value changes. |
|
|
112
|
+
| change | `CustomEvent<{value: string}>` | Fired when the selected value changes by user interaction. |
|
|
113
|
+
|
|
114
|
+
## Slots
|
|
115
|
+
|
|
116
|
+
| Slot | Description |
|
|
117
|
+
| --- | --- |
|
|
118
|
+
| (default) | Place one or more `<obc-toggle-button-vertical-option>` elements here to define the selectable options. |
|
|
119
|
+
|
|
120
|
+
## Stories
|
|
121
|
+
|
|
122
|
+
- [Regular](https://openbridge-next-storybook.web.app/?path=/story/ui-components-selection-controls-and-switches-toggle-button-vertical--regular)
|
|
123
|
+
- [Regular Disabled](https://openbridge-next-storybook.web.app/?path=/story/ui-components-selection-controls-and-switches-toggle-button-vertical--regular-disabled)
|
|
124
|
+
- [Flat](https://openbridge-next-storybook.web.app/?path=/story/ui-components-selection-controls-and-switches-toggle-button-vertical--flat)
|
|
125
|
+
- [Flat Disabled](https://openbridge-next-storybook.web.app/?path=/story/ui-components-selection-controls-and-switches-toggle-button-vertical--flat-disabled)
|
|
126
|
+
- [Icons Only Regular](https://openbridge-next-storybook.web.app/?path=/story/ui-components-selection-controls-and-switches-toggle-button-vertical--icons-only-regular)
|
|
127
|
+
- [Icons Only Regular Disabled](https://openbridge-next-storybook.web.app/?path=/story/ui-components-selection-controls-and-switches-toggle-button-vertical--icons-only-regular-disabled)
|
|
128
|
+
- [Icons Only Flat](https://openbridge-next-storybook.web.app/?path=/story/ui-components-selection-controls-and-switches-toggle-button-vertical--icons-only-flat)
|
|
129
|
+
- [Icons Only Flat Disabled](https://openbridge-next-storybook.web.app/?path=/story/ui-components-selection-controls-and-switches-toggle-button-vertical--icons-only-flat-disabled)
|
|
130
|
+
- [Label Under Regular](https://openbridge-next-storybook.web.app/?path=/story/ui-components-selection-controls-and-switches-toggle-button-vertical--label-under-regular)
|
|
131
|
+
- [Label Under Regular Disabled](https://openbridge-next-storybook.web.app/?path=/story/ui-components-selection-controls-and-switches-toggle-button-vertical--label-under-regular-disabled)
|
|
132
|
+
- [Label Under Flat](https://openbridge-next-storybook.web.app/?path=/story/ui-components-selection-controls-and-switches-toggle-button-vertical--label-under-flat)
|
|
133
|
+
- [Label Under Flat Disabled](https://openbridge-next-storybook.web.app/?path=/story/ui-components-selection-controls-and-switches-toggle-button-vertical--label-under-flat-disabled)
|
|
134
|
+
- [Label Under Mixed Regular](https://openbridge-next-storybook.web.app/?path=/story/ui-components-selection-controls-and-switches-toggle-button-vertical--label-under-mixed-regular)
|
|
135
|
+
- [Icon Under Mixed Regular](https://openbridge-next-storybook.web.app/?path=/story/ui-components-selection-controls-and-switches-toggle-button-vertical--icon-under-mixed-regular)
|
|
136
|
+
- [Inline Mixed Flat](https://openbridge-next-storybook.web.app/?path=/story/ui-components-selection-controls-and-switches-toggle-button-vertical--inline-mixed-flat)
|
|
137
|
+
- [Inline Mixed Regular](https://openbridge-next-storybook.web.app/?path=/story/ui-components-selection-controls-and-switches-toggle-button-vertical--inline-mixed-regular)
|
|
138
|
+
- [Normal](https://openbridge-next-storybook.web.app/?path=/story/ui-components-selection-controls-and-switches-toggle-button-vertical--normal)
|
|
139
|
+
- [Selection Behavior](https://openbridge-next-storybook.web.app/?path=/story/ui-components-selection-controls-and-switches-toggle-button-vertical--selection-behavior)
|
|
140
|
+
- [Mixed Disabled States](https://openbridge-next-storybook.web.app/?path=/story/ui-components-selection-controls-and-switches-toggle-button-vertical--mixed-disabled-states)
|
|
141
|
+
- [Empty Selection When Unmatched](https://openbridge-next-storybook.web.app/?path=/story/ui-components-selection-controls-and-switches-toggle-button-vertical--empty-selection-when-unmatched)
|
|
142
|
+
- [Initially Disabled Selection Falls Back](https://openbridge-next-storybook.web.app/?path=/story/ui-components-selection-controls-and-switches-toggle-button-vertical--initially-disabled-selected)
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
# `<obc-toggle-button-vertical-option>`
|
|
2
|
+
|
|
3
|
+
A single selectable option within a vertical toggle button group.
|
|
4
|
+
|
|
5
|
+
Lifecycle: stable. [Source](https://raw.githubusercontent.com/Ocean-Industries-Concept-Lab/openbridge-webcomponents/develop/packages/openbridge-webcomponents/src/components/toggle-button-vertical-option/toggle-button-vertical-option.ts)
|
|
6
|
+
|
|
7
|
+
`<obc-toggle-button-vertical-option>` – A single selectable option within a vertical toggle button group.
|
|
8
|
+
|
|
9
|
+
Represents an individual button option within an `<obc-toggle-button-vertical-group>`. This component should not
|
|
10
|
+
be used standalone; it is designed to function exclusively as a child element of a vertical toggle button group,
|
|
11
|
+
which manages selection state and interaction logic.
|
|
12
|
+
|
|
13
|
+
The option renders as a vertically oriented button with flexible content layouts (icon, text label, or both) and
|
|
14
|
+
provides visual feedback for selection and disabled states. All styling properties (type, variant) are typically
|
|
15
|
+
propagated from the parent group to ensure visual consistency across all options.
|
|
16
|
+
|
|
17
|
+
## Features
|
|
18
|
+
|
|
19
|
+
- **Selection state:** Displays a distinct visual style when selected, controlled by the parent group.
|
|
20
|
+
Only one option in a group can be selected at a time.
|
|
21
|
+
- **Disabled state:** Can be individually disabled while other options in the group remain interactive.
|
|
22
|
+
When disabled, the option is visually dimmed and does not respond to clicks. The parent group will skip
|
|
23
|
+
over disabled options when determining fallback selections.
|
|
24
|
+
- **Flexible content layouts:**
|
|
25
|
+
- Icon and text can be displayed side-by-side (`inline`) or with text positioned below the icon (`under`).
|
|
26
|
+
- Controlled via the `labelPlacement` property.
|
|
27
|
+
- **Visual variants:**
|
|
28
|
+
- `regular` (default): Standard appearance with full background and border styling.
|
|
29
|
+
- `flat`: Minimal style with reduced visual weight.
|
|
30
|
+
- `normal`: **TODO(designer)** – Clarify the visual difference and intended use case for the `normal` variant compared to `regular` and `flat`.
|
|
31
|
+
- **Divider handling:** Supports automatic divider rendering between options. The `showDivider` property is
|
|
32
|
+
managed by the parent group to hide dividers after the last option for a cohesive appearance.
|
|
33
|
+
|
|
34
|
+
## Usage Guidelines
|
|
35
|
+
|
|
36
|
+
**Always use `<obc-toggle-button-vertical-option>` as a child of `<obc-toggle-button-vertical-group>`.** The parent group
|
|
37
|
+
handles all selection logic, event coordination, and style propagation. Using this component outside a
|
|
38
|
+
group will result in non-functional behavior.
|
|
39
|
+
|
|
40
|
+
**Ideal use cases:**
|
|
41
|
+
- As a building block for vertical navigation or view toggles
|
|
42
|
+
- As filter options within a vertical segmented control
|
|
43
|
+
- As mode selectors in sidebars or vertical control panels
|
|
44
|
+
|
|
45
|
+
**Best Practices:**
|
|
46
|
+
- Assign a unique `value` to each option in the group to enable proper selection tracking.
|
|
47
|
+
- Use the `label` property for text labels (short, descriptive text: 1-2 words ideal).
|
|
48
|
+
- Use the `icon` slot for icon content when icons are needed.
|
|
49
|
+
- Set `hasIcon` to true when providing icon content for proper layout.
|
|
50
|
+
- Avoid manually setting `type` property; let the parent group propagate this for consistency.
|
|
51
|
+
- For icon-only options, ensure icons are universally understandable or provide tooltips for accessibility.
|
|
52
|
+
- Use the `disabled` property sparingly; if all options are disabled, consider disabling the entire group instead.
|
|
53
|
+
|
|
54
|
+
**When not to use:**
|
|
55
|
+
- Do not use this component standalone without a parent `<obc-toggle-button-vertical-group>`.
|
|
56
|
+
- Do not use for multi-select scenarios (use checkboxes or chips instead).
|
|
57
|
+
- Do not use for standalone action buttons (use `<obc-button>` or similar instead).
|
|
58
|
+
|
|
59
|
+
## Slots
|
|
60
|
+
|
|
61
|
+
| Slot Name | Renders When... | Purpose |
|
|
62
|
+
|-----------|-----------------|---------|
|
|
63
|
+
| icon | When `hasIcon` is true | Icon content for the option. Use OpenBridge icons like `<obi-placeholder>` or `<obi-search>`. |
|
|
64
|
+
|
|
65
|
+
## Events
|
|
66
|
+
|
|
67
|
+
- `selected` – Fired when the option is clicked. The parent group listens to this event to update selection state.
|
|
68
|
+
Event detail: `{ value: string }`.
|
|
69
|
+
|
|
70
|
+
## Example
|
|
71
|
+
|
|
72
|
+
```html
|
|
73
|
+
<!-- Used within a vertical toggle button group -->
|
|
74
|
+
<obc-toggle-button-vertical-group value="list">
|
|
75
|
+
<obc-toggle-button-vertical-option value="list" label="List" hasIcon>
|
|
76
|
+
<obi-placeholder slot="icon"></obi-placeholder>
|
|
77
|
+
</obc-toggle-button-vertical-option>
|
|
78
|
+
<obc-toggle-button-vertical-option value="grid" label="Grid" hasIcon>
|
|
79
|
+
<obi-placeholder slot="icon"></obi-placeholder>
|
|
80
|
+
</obc-toggle-button-vertical-option>
|
|
81
|
+
<obc-toggle-button-vertical-option value="chart" label="Chart" disabled hasIcon>
|
|
82
|
+
<obi-placeholder slot="icon"></obi-placeholder>
|
|
83
|
+
</obc-toggle-button-vertical-option>
|
|
84
|
+
</obc-toggle-button-vertical-group>
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Properties
|
|
88
|
+
|
|
89
|
+
| Property | Attribute | Type | Default | Description |
|
|
90
|
+
| --- | --- | --- | --- | --- |
|
|
91
|
+
| value | value | `string` | `''` | Value associated with this option. Used in selection events. |
|
|
92
|
+
| selected | selected | `boolean` | `false` | Whether this option is currently selected (toggles visual state). |
|
|
93
|
+
| type | type | | | The visual variant of the toggle button option. One of: "flat", "regular", "normal". |
|
|
94
|
+
| showDivider | showDivider | `boolean` | `true` | If true, renders the divider after this option. Managed by the parent group. |
|
|
95
|
+
| hasIcon | hasIcon | `boolean` | `false` | If true, the option expects icon content in the icon slot. Controls layout and spacing for icon display. |
|
|
96
|
+
| label | label | `string` | `''` | Text label for the option. Displayed next to or below the icon based on labelPlacement. |
|
|
97
|
+
| disabled | disabled | `boolean` | `false` | If true, the option is disabled and cannot be interacted with. |
|
|
98
|
+
| labelPlacement | labelPlacement | `ObcToggleButtonLabelPlacement` | | Layout of icon and label: `inline` puts them side-by-side, `under` puts the label below the icon. |
|
|
99
|
+
|
|
100
|
+
## Events
|
|
101
|
+
|
|
102
|
+
| Event | Type | Description |
|
|
103
|
+
| --- | --- | --- |
|
|
104
|
+
| selected | `CustomEvent<{value: string}>` | Fired when the option is clicked. |
|
|
105
|
+
|
|
106
|
+
## Slots
|
|
107
|
+
|
|
108
|
+
| Slot | Description |
|
|
109
|
+
| --- | --- |
|
|
110
|
+
| icon | Icon content for the option (when hasIcon is true). |
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
# `<obc-toggle-switch>`
|
|
2
|
+
|
|
3
|
+
A toggle switch component for binary on/off selection (also known as a switch, toggle, or enable/disable control).
|
|
4
|
+
|
|
5
|
+
Lifecycle: stable. [Storybook](https://openbridge-next-storybook.web.app/?path=/docs/ui-components-selection-controls-and-switches-toggle-switch--docs) · [Source](https://raw.githubusercontent.com/Ocean-Industries-Concept-Lab/openbridge-webcomponents/develop/packages/openbridge-webcomponents/src/components/toggle-switch/toggle-switch.ts)
|
|
6
|
+
|
|
7
|
+
`<obc-toggle-switch>` – A toggle switch component for binary on/off selection (also known as a switch, toggle, or enable/disable control).
|
|
8
|
+
|
|
9
|
+
Provides a visual switch control for toggling between two states (checked/unchecked), commonly used for enabling or disabling a setting or feature. The component supports an optional label, description, icon, and divider for flexible presentation in lists or forms.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Features
|
|
14
|
+
- **Binary toggle:** Allows users to switch between checked (on) and unchecked (off) states.
|
|
15
|
+
- **Label and Description:** Displays a primary label and an optional secondary description for context.
|
|
16
|
+
- **Icon Support:** Can display a leading icon via the `icon` slot for visual emphasis.
|
|
17
|
+
- **Disabled State:** Can be set to disabled, preventing user interaction and visually indicating inactivity.
|
|
18
|
+
- **Bottom Divider:** Optional divider for use in lists or grouped settings.
|
|
19
|
+
- **Responsive Layout:** Adapts label/description layout based on content; long descriptions are truncated with ellipsis.
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## Usage Guidelines
|
|
24
|
+
Use `obc-toggle-switch` for settings or preferences that require a simple on/off or enable/disable control. Ideal for scenarios where the user needs to quickly toggle a feature, such as activating notifications, enabling dark mode, or switching connectivity options. Avoid using for mutually exclusive choices—use radio buttons for those cases.
|
|
25
|
+
|
|
26
|
+
- Place in forms, settings panels, or lists where binary choices are needed.
|
|
27
|
+
- Use the description property to clarify the effect of the toggle if the label alone is not sufficient.
|
|
28
|
+
- If an icon is relevant, provide it via the `icon` slot to reinforce the meaning.
|
|
29
|
+
- For accessibility, ensure the label clearly describes the toggle's function.
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## Slots
|
|
34
|
+
| Slot Name | Renders When... | Purpose |
|
|
35
|
+
|-----------|---------------------|-------------------------------------------|
|
|
36
|
+
| icon | `hasIcon` is true | Leading icon to visually represent toggle |
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## Properties and Attributes
|
|
41
|
+
- `label` (string): Main label for the toggle (required for clarity).
|
|
42
|
+
- `checked` (boolean): Whether the toggle is in the "on" state. Defaults to `false`.
|
|
43
|
+
- `disabled` (boolean): Disables interaction and applies a disabled style.
|
|
44
|
+
- `hasDescription` (boolean): If true, shows the description text below the label.
|
|
45
|
+
- `description` (string): Supplementary text shown when `hasDescription` is true.
|
|
46
|
+
- `hasBottomDivider` (boolean): If true, renders a divider below the toggle (useful in lists).
|
|
47
|
+
- `hasIcon` (boolean): If true, displays the `icon` slot before the label.
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## Events
|
|
52
|
+
- `input` – Fired when the toggle state changes (checked/unchecked).
|
|
53
|
+
- `change` – Fired when the toggle state changes by user interaction.
|
|
54
|
+
|
|
55
|
+
Both events report the state the user selected. When `externalControl` is
|
|
56
|
+
true the component does not update itself; the consumer decides whether to
|
|
57
|
+
apply the reported state to `checked` and may reject the interaction by
|
|
58
|
+
leaving `checked` unchanged.
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## Best Practices
|
|
63
|
+
- Use concise labels and keep descriptions brief; long descriptions are truncated.
|
|
64
|
+
- Only use the divider when presenting multiple toggles in a list for visual separation.
|
|
65
|
+
- For accessibility, ensure the label is descriptive and unique within the context.
|
|
66
|
+
- Avoid using toggle switches for actions that require confirmation or have destructive effects.
|
|
67
|
+
- For mutually exclusive options, use radio buttons instead.
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
**Example:**
|
|
72
|
+
```html
|
|
73
|
+
<obc-toggle-switch
|
|
74
|
+
label="Enable notifications"
|
|
75
|
+
?checked=${true}
|
|
76
|
+
?hasDescription=${true}
|
|
77
|
+
description="Receive updates and alerts"
|
|
78
|
+
?hasIcon=${true}
|
|
79
|
+
>
|
|
80
|
+
<obi-placeholder slot="icon"></obi-placeholder>
|
|
81
|
+
</obc-toggle-switch>
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
In this example, the toggle switch displays a label, an icon, and a description, and is in the checked state.
|
|
85
|
+
|
|
86
|
+
## Properties
|
|
87
|
+
|
|
88
|
+
| Property | Attribute | Type | Default | Description |
|
|
89
|
+
| --- | --- | --- | --- | --- |
|
|
90
|
+
| label | label | `string` | `'Label'` | Main label for the toggle switch. Should clearly describe the setting being toggled. |
|
|
91
|
+
| checked | checked | `boolean` | `false` | Whether the toggle is in the "on" (checked) state. Set to true to display as active/on. |
|
|
92
|
+
| disabled | disabled | `boolean` | `false` | Disables the toggle, preventing user interaction and applying a disabled style. |
|
|
93
|
+
| hasDescription | hasDescription | `boolean` | `false` | If true, displays the description text below the label. |
|
|
94
|
+
| description | description | `string` | `''` | Supplementary description text shown when `hasDescription` is true. Use to clarify the effect or details of the toggle. Available when `hasDescription==true`. |
|
|
95
|
+
| hasBottomDivider | hasBottomDivider | `boolean` | `false` | If true, renders a divider below the toggle switch. Useful for visually separating items in a list. |
|
|
96
|
+
| hasIcon | hasIcon | `boolean` | `false` | If true, displays a leading icon before the label. Provide icon content via the `icon` slot. |
|
|
97
|
+
| externalControl | externalControl | `boolean` | `false` | If true, the toggle is controlled externally. Use to control the toggle state from outside the component. |
|
|
98
|
+
|
|
99
|
+
## Events
|
|
100
|
+
|
|
101
|
+
| Event | Type | Description |
|
|
102
|
+
| --- | --- | --- |
|
|
103
|
+
| input | `ObcToggleSwitchInputEvent` | Dispatched when the value of the input changes |
|
|
104
|
+
| change | `ObcToggleSwitchChangeEvent` | Dispatched when the value of the input changes by user interaction |
|
|
105
|
+
|
|
106
|
+
## Slots
|
|
107
|
+
|
|
108
|
+
| Slot | Description |
|
|
109
|
+
| --- | --- |
|
|
110
|
+
| icon | Leading icon slot (shown when `hasIcon` is true) |
|
|
111
|
+
|
|
112
|
+
## Stories
|
|
113
|
+
|
|
114
|
+
- [Default](https://openbridge-next-storybook.web.app/?path=/story/ui-components-selection-controls-and-switches-toggle-switch--default)
|
|
115
|
+
- [Primary](https://openbridge-next-storybook.web.app/?path=/story/ui-components-selection-controls-and-switches-toggle-switch--primary)
|
|
116
|
+
- [With Description](https://openbridge-next-storybook.web.app/?path=/story/ui-components-selection-controls-and-switches-toggle-switch--with-description)
|
|
117
|
+
- [With Icon](https://openbridge-next-storybook.web.app/?path=/story/ui-components-selection-controls-and-switches-toggle-switch--with-icon)
|
|
118
|
+
- [With Icon And Long Description](https://openbridge-next-storybook.web.app/?path=/story/ui-components-selection-controls-and-switches-toggle-switch--with-icon-and-long-description)
|
|
119
|
+
- [Disabled](https://openbridge-next-storybook.web.app/?path=/story/ui-components-selection-controls-and-switches-toggle-switch--disabled)
|
|
120
|
+
- [Disabled Checked](https://openbridge-next-storybook.web.app/?path=/story/ui-components-selection-controls-and-switches-toggle-switch--disabled-checked)
|
|
121
|
+
- [With Bottom Divider](https://openbridge-next-storybook.web.app/?path=/story/ui-components-selection-controls-and-switches-toggle-switch--with-bottom-divider)
|
|
122
|
+
- [Multiple Toggles](https://openbridge-next-storybook.web.app/?path=/story/ui-components-selection-controls-and-switches-toggle-switch--multiple-toggles)
|
|
123
|
+
|
|
124
|
+
## See also
|
|
125
|
+
|
|
126
|
+
- [Migration Guide](https://openbridge-next-storybook.web.app/docs/introduction-migration-guide.md)
|