@fundamental-styles/mcp 0.41.7-rc.8 → 0.41.7
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/data/AI_USAGE.md +425 -0
- package/data/CHANGELOG.md +53 -3
- package/data/component-catalog.json +62 -209
- package/data/components/README.md +281 -0
- package/data/components/action-bar.md +443 -0
- package/data/components/ai-busy-indicator.md +79 -0
- package/data/components/ai-loading-bar.md +66 -0
- package/data/components/avatar-btp.md +198 -0
- package/data/components/avatar-group.md +2660 -0
- package/data/components/avatar-product-switch.md +476 -0
- package/data/components/avatar.md +993 -0
- package/data/components/bar.md +574 -0
- package/data/components/border-radius.md +148 -0
- package/data/components/border.md +412 -0
- package/data/components/breadcrumb.md +546 -0
- package/data/components/button-2.md +440 -0
- package/data/components/button-action-sheet.md +292 -0
- package/data/components/button-ai.md +730 -0
- package/data/components/button-btp.md +223 -0
- package/data/components/button-button.md +233 -0
- package/data/components/button-counter.md +176 -0
- package/data/components/button-patterns.md +731 -0
- package/data/components/button-split.md +459 -0
- package/data/components/button.md +469 -0
- package/data/components/calendar.md +5784 -0
- package/data/components/card-card-media.md +707 -0
- package/data/components/card-card.md +2426 -0
- package/data/components/card-layouts.md +1201 -0
- package/data/components/card.md +2404 -0
- package/data/components/carousel.md +1506 -0
- package/data/components/code.md +139 -0
- package/data/components/component-reset.md +272 -0
- package/data/components/components-icons-businesssuiteinappsymbol-icons.md +85 -0
- package/data/components/components-icons-sap-icons.md +147 -0
- package/data/components/components-icons-tnt-icons.md +85 -0
- package/data/components/container-queries.md +221 -0
- package/data/components/container.md +227 -0
- package/data/components/dialog-docs-static-busy-indicator.md +165 -0
- package/data/components/dialog-docs-static-dialog.md +949 -0
- package/data/components/dialog-docs-static-patterns.md +147 -0
- package/data/components/dialog-docs-static-settings.md +528 -0
- package/data/components/dialog-docs-static.md +982 -0
- package/data/components/dialog.md +606 -0
- package/data/components/dynamic-page-dynamic-page.md +1914 -0
- package/data/components/dynamic-page.md +973 -0
- package/data/components/dynamic-side.md +197 -0
- package/data/components/elevation.md +110 -0
- package/data/components/feed-input.md +346 -0
- package/data/components/feed-list.md +580 -0
- package/data/components/fieldset-2.md +292 -0
- package/data/components/fieldset-forms.md +169 -0
- package/data/components/fieldset.md +381 -0
- package/data/components/flexible-column-layout.md +205 -0
- package/data/components/form-group.md +287 -0
- package/data/components/form-header.md +71 -0
- package/data/components/form-item-2.md +98 -0
- package/data/components/form-item-3.md +134 -0
- package/data/components/form-item-4.md +556 -0
- package/data/components/form-item-5.md +182 -0
- package/data/components/form-item-6.md +539 -0
- package/data/components/form-item-7.md +239 -0
- package/data/components/form-item-ai.md +158 -0
- package/data/components/form-item-file-uploader.md +445 -0
- package/data/components/form-item-forms.md +234 -0
- package/data/components/form-item-patterns.md +426 -0
- package/data/components/form-item.md +464 -0
- package/data/components/form-label-ai.md +126 -0
- package/data/components/form-label-layouts.md +306 -0
- package/data/components/form-label-patterns.md +1175 -0
- package/data/components/form-label-status-indicator.md +1083 -0
- package/data/components/form-label-step-input.md +620 -0
- package/data/components/form-label.md +2876 -0
- package/data/components/generic-tag.md +747 -0
- package/data/components/grid-list-grid-list.md +1185 -0
- package/data/components/grid-list.md +1449 -0
- package/data/components/heading.md +66 -0
- package/data/components/horizontal-navigation.md +568 -0
- package/data/components/icon-tab-bar-dev.md +190 -0
- package/data/components/icon-tab-bar.md +2620 -0
- package/data/components/icon.md +171 -0
- package/data/components/iconBusinessSuite.md +92 -0
- package/data/components/iconTnt.md +92 -0
- package/data/components/illustrated-message.md +439 -0
- package/data/components/info-label.md +348 -0
- package/data/components/input-group.md +2068 -0
- package/data/components/label.md +66 -0
- package/data/components/layout-grid.md +447 -0
- package/data/components/layout-panel.md +261 -0
- package/data/components/layouts-layout-grid.md +608 -0
- package/data/components/layouts-paddings.md +133 -0
- package/data/components/layouts-section.md +287 -0
- package/data/components/list-2.md +148 -0
- package/data/components/list-3.md +735 -0
- package/data/components/list-list.md +790 -0
- package/data/components/list-object-list.md +1225 -0
- package/data/components/list.md +1286 -0
- package/data/components/media-queries.md +168 -0
- package/data/components/menu.md +946 -0
- package/data/components/message-box-docs-static-ai.md +149 -0
- package/data/components/message-box-docs-static.md +527 -0
- package/data/components/message-page-upload-collection.md +678 -0
- package/data/components/message-page.md +256 -0
- package/data/components/message-strip.md +977 -0
- package/data/components/message-toast.md +119 -0
- package/data/components/micro-process-flow.md +991 -0
- package/data/components/navigation-menu.md +366 -0
- package/data/components/navigation-navigation.md +1245 -0
- package/data/components/navigation.md +2604 -0
- package/data/components/numeric-content.md +317 -0
- package/data/components/object-attribute.md +96 -0
- package/data/components/object-identifier.md +227 -0
- package/data/components/object-marker.md +202 -0
- package/data/components/object-number.md +327 -0
- package/data/components/object-status.md +1538 -0
- package/data/components/off-screen.md +87 -0
- package/data/components/overflow.md +97 -0
- package/data/components/padding.md +122 -0
- package/data/components/paddings.md +130 -0
- package/data/components/page.md +300 -0
- package/data/components/pagination.md +672 -0
- package/data/components/panel-layouts.md +345 -0
- package/data/components/panel.md +514 -0
- package/data/components/patterns-label.md +74 -0
- package/data/components/popover-2.md +906 -0
- package/data/components/popover-ai.md +466 -0
- package/data/components/popover-btp.md +886 -0
- package/data/components/popover-deprecated.md +308 -0
- package/data/components/popover-message-popover.md +683 -0
- package/data/components/popover-notification.md +1511 -0
- package/data/components/popover-patterns.md +1100 -0
- package/data/components/popover-popover.md +1862 -0
- package/data/components/popover-quick-view.md +385 -0
- package/data/components/popover-timepicker.md +1836 -0
- package/data/components/popover-user-menu.md +1303 -0
- package/data/components/popover.md +1938 -0
- package/data/components/progress-indicator.md +351 -0
- package/data/components/prompt-input-ai.md +226 -0
- package/data/components/prompt-input.md +226 -0
- package/data/components/rating-indicator.md +1469 -0
- package/data/components/resizable-card-layout.md +951 -0
- package/data/components/scrollbar.md +86 -0
- package/data/components/search-field.md +287 -0
- package/data/components/section.md +250 -0
- package/data/components/segmented-button.md +324 -0
- package/data/components/shellbar.md +2183 -0
- package/data/components/side-nav.md +1562 -0
- package/data/components/skeleton.md +243 -0
- package/data/components/slider.md +395 -0
- package/data/components/splitter.md +353 -0
- package/data/components/table.md +2749 -0
- package/data/components/tabs.md +658 -0
- package/data/components/text-text.md +380 -0
- package/data/components/text.md +253 -0
- package/data/components/tile.md +1132 -0
- package/data/components/time.md +818 -0
- package/data/components/title.md +153 -0
- package/data/components/titles.md +83 -0
- package/data/components/token.md +311 -0
- package/data/components/tokenizer.md +398 -0
- package/data/components/tool-header.md +1352 -0
- package/data/components/tool-layout.md +199 -0
- package/data/components/toolbar-ai.md +174 -0
- package/data/components/toolbar-btp.md +526 -0
- package/data/components/toolbar-title-bar.md +473 -0
- package/data/components/toolbar.md +432 -0
- package/data/components/tree.md +1031 -0
- package/data/components/typography.md +435 -0
- package/data/components/variant-management.md +360 -0
- package/data/components/vertical-nav.md +589 -0
- package/data/components/wizard.md +1429 -0
- package/data/examples/Components/dialog/device-specifications.example.html +39 -30
- package/data/examples/Components/shellbar/optional-items.example.html +210 -157
- package/data/examples/Components/shellbar/overflow-toolbar.example.html +202 -177
- package/data/examples/Components/shellbar/responsive-paddings.example.html +217 -146
- package/data/examples/Components/shellbar/responsiveness.example.html +825 -613
- package/data/examples/Components/user-menu/default.example.html +241 -83
- package/data/schemas/badge.schema.json +1 -1
- package/data/schemas/button-split.schema.json +1 -1
- package/data/schemas/component-frontmatter.schema.json +123 -0
- package/data/schemas/component-markdown.schema.json +81 -0
- package/data/schemas/counter.schema.json +1 -1
- package/data/schemas/dynamic-page.schema.json +1 -1
- package/data/schemas/dynamic-side-content.schema.json +1 -1
- package/data/schemas/facet.schema.json +1 -1
- package/data/schemas/fieldset.schema.json +1 -1
- package/data/schemas/flexible-column-layout.schema.json +1 -1
- package/data/schemas/form-group.schema.json +3 -2
- package/data/schemas/form-header.schema.json +1 -1
- package/data/schemas/form-label.schema.json +1 -0
- package/data/schemas/form-message.schema.json +1 -1
- package/data/schemas/grid-list.schema.json +1 -1
- package/data/schemas/input-group.schema.json +1 -1
- package/data/schemas/layout-panel.schema.json +1 -1
- package/data/schemas/page.schema.json +1 -1
- package/data/schemas/quick-view.schema.json +2 -1
- package/data/schemas/section.schema.json +1 -1
- package/data/schemas/side-nav.schema.json +1 -1
- package/data/schemas/splitter.schema.json +1 -1
- package/data/schemas/tabs.schema.json +1 -1
- package/data/schemas/tile.schema.json +1 -1
- package/data/schemas/tool-layout.schema.json +1 -1
- package/data/schemas/user-menu.schema.json +10 -0
- package/data/schemas/wizard.schema.json +1 -1
- package/package.json +1 -1
- package/src/data/load-catalog.d.ts +2 -0
- package/src/data/load-catalog.js +5 -1
- package/src/data/load-catalog.js.map +1 -1
- package/src/data/load-markdown-docs.d.ts +44 -0
- package/src/data/load-markdown-docs.js +179 -0
- package/src/data/load-markdown-docs.js.map +1 -0
- package/src/data/markdown-cache.d.ts +60 -0
- package/src/data/markdown-cache.js +218 -0
- package/src/data/markdown-cache.js.map +1 -0
- package/src/server.js +72 -1
- package/src/server.js.map +1 -1
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
---
|
|
2
|
+
component: fd-form-group
|
|
3
|
+
title: Components/Switch
|
|
4
|
+
category: Components
|
|
5
|
+
selector: fd-form-group
|
|
6
|
+
cssFile: form-group.css
|
|
7
|
+
sourcePath: packages/styles/stories/Components/switch/switch.stories.js
|
|
8
|
+
tags: []
|
|
9
|
+
dependencies: ["form-label","icon","switch"]
|
|
10
|
+
relatedComponents: ["form-label","icon","switch"]
|
|
11
|
+
stability: stable
|
|
12
|
+
generatedAt: 2026-06-09T18:29:01.400Z
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
# Components/Switch
|
|
16
|
+
|
|
17
|
+
The switch mimics a physical switch, allowing users to set individual features (such as personalization or display settings) to either active or inactive. What the switch controls should be clarified with an inline label, while the state it’s currently in should be displayed on the switch itself.
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
##Usage
|
|
21
|
+
**Use the switch if:**
|
|
22
|
+
|
|
23
|
+
- You want to enable users to set something as active or inactive (for example, within a **Dialog**).
|
|
24
|
+
- You need to clearly show the mode or state of a setting.
|
|
25
|
+
- The change takes immediate effect.
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
**Do not use the switch if:**
|
|
29
|
+
|
|
30
|
+
- The user has to choose several options or perform extra steps for changes to become effective.
|
|
31
|
+
- The setting requires a confirmation action or _Submit_ button before it can take effect. In this case, use a **Checkbox** instead.
|
|
32
|
+
- It’s not clear if the control is showing a state or an action. In this case, use a **Checkbox** instead.
|
|
33
|
+
|
|
34
|
+
## Usage Guidelines
|
|
35
|
+
|
|
36
|
+
**Use the switch if:**
|
|
37
|
+
|
|
38
|
+
- You want to enable users to set something as active or inactive (for example, within a **Dialog**).
|
|
39
|
+
- You need to clearly show the mode or state of a setting.
|
|
40
|
+
- The change takes immediate effect.
|
|
41
|
+
|
|
42
|
+
## When Not To Use
|
|
43
|
+
|
|
44
|
+
- The user has to choose several options or perform extra steps for changes to become effective.
|
|
45
|
+
- The setting requires a confirmation action or _Submit_ button before it can take effect. In this case, use a **Checkbox** instead.
|
|
46
|
+
- It’s not clear if the control is showing a state or an action. In this case, use a **Checkbox** instead.
|
|
47
|
+
|
|
48
|
+
## Dependencies
|
|
49
|
+
|
|
50
|
+
This component depends on the following CSS files:
|
|
51
|
+
|
|
52
|
+
- `form-label.css`
|
|
53
|
+
- `icon.css`
|
|
54
|
+
- `switch.css`
|
|
55
|
+
|
|
56
|
+
## Installation
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
npm install fundamental-styles
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
```html
|
|
63
|
+
<!-- Include theme -->
|
|
64
|
+
<link href="node_modules/fundamental-styles/dist/theming/sap_horizon.css" rel="stylesheet">
|
|
65
|
+
|
|
66
|
+
<!-- Include component CSS -->
|
|
67
|
+
<link href="node_modules/fundamental-styles/dist/form-group.css" rel="stylesheet">
|
|
68
|
+
|
|
69
|
+
<!-- Include dependencies -->
|
|
70
|
+
<link href="node_modules/fundamental-styles/dist/form-label.css" rel="stylesheet">
|
|
71
|
+
<link href="node_modules/fundamental-styles/dist/icon.css" rel="stylesheet">
|
|
72
|
+
<link href="node_modules/fundamental-styles/dist/switch.css" rel="stylesheet">
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Basic Usage
|
|
76
|
+
|
|
77
|
+
```html
|
|
78
|
+
<div class="fd-form-group">
|
|
79
|
+
<div class="fd-form-item">
|
|
80
|
+
<div class="fd-form-label" id="label1">Default Switch</div>
|
|
81
|
+
<label class="fd-switch">
|
|
82
|
+
<span class="fd-switch__control">
|
|
83
|
+
<input
|
|
84
|
+
class="fd-switch__input"
|
|
85
|
+
type="checkbox"
|
|
86
|
+
name=""
|
|
87
|
+
value=""
|
|
88
|
+
aria-labelledby="label1"
|
|
89
|
+
id="y21YO3251"
|
|
90
|
+
/>
|
|
91
|
+
<div class="fd-switch__slider">
|
|
92
|
+
<div class="fd-switch__track">
|
|
93
|
+
<i role="presentation" class="fd-switch__icon fd-switch__icon--on sap-icon--accept"></i>
|
|
94
|
+
<span class="fd-switch__handle" role="presentation"></span>
|
|
95
|
+
<i role="presentation" class="fd-switch__icon fd-switch__icon--off sap-icon--less"></i>
|
|
96
|
+
</div>
|
|
97
|
+
</div>
|
|
98
|
+
</span>
|
|
99
|
+
</label>
|
|
100
|
+
</div>
|
|
101
|
+
<div class="fd-form-item">
|
|
102
|
+
<div class="fd-form-label" id="label7">Disabled Switch</div>
|
|
103
|
+
<label class="fd-switch is-disabled">
|
|
104
|
+
<span class="fd-switch__control">
|
|
105
|
+
<input
|
|
106
|
+
class="fd-switch__input"
|
|
107
|
+
type="checkbox"
|
|
108
|
+
name=""
|
|
109
|
+
value=""
|
|
110
|
+
aria-labelledby="label7"
|
|
111
|
+
id="y21Y13431"
|
|
112
|
+
/>
|
|
113
|
+
<div class="fd-switch__slider">
|
|
114
|
+
<div class="fd-switch__track">
|
|
115
|
+
<i role="presentation" class="fd-switch__icon fd-switch__icon--on sap-icon--accept"></i>
|
|
116
|
+
<span class="fd-switch__handle" role="presentation"></span>
|
|
117
|
+
<i role="presentation" class="fd-switch__icon fd-switch__icon--off sap-icon--less"></i>
|
|
118
|
+
</div>
|
|
119
|
+
</div>
|
|
120
|
+
</span>
|
|
121
|
+
</label>
|
|
122
|
+
</div>
|
|
123
|
+
</div>
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## States
|
|
127
|
+
|
|
128
|
+
| Class | Description |
|
|
129
|
+
|-------|-------------|
|
|
130
|
+
| `is-disabled` | Disabled state |
|
|
131
|
+
|
|
132
|
+
## Related Components
|
|
133
|
+
|
|
134
|
+
This component works with or depends on:
|
|
135
|
+
|
|
136
|
+
- `form-label`
|
|
137
|
+
- `icon`
|
|
138
|
+
- `switch`
|
|
139
|
+
|
|
140
|
+
## Design Tokens
|
|
141
|
+
|
|
142
|
+
Key CSS variables used by this component:
|
|
143
|
+
|
|
144
|
+
- `--fdFormGroupPaddingInline`
|
|
145
|
+
- `--inline`
|
|
146
|
+
- `--no-border`
|
|
147
|
+
- `--no-padding`
|
|
148
|
+
- `--sapElement_LineHeight`
|
|
149
|
+
- `--sapFontHeaderFamily`
|
|
150
|
+
- `--sapGroup_TitleBackground`
|
|
151
|
+
- `--sapGroup_TitleBorderColor`
|
|
152
|
+
- `--sapGroup_TitleBorderWidth`
|
|
153
|
+
- `--sapGroup_TitleTextColor`
|
|
154
|
+
- `--sapGroup_Title_FontSize`
|
|
155
|
+
- `--with-spacing`
|
|
156
|
+
- `--wrap`
|
|
157
|
+
|
|
158
|
+
## Examples
|
|
159
|
+
|
|
160
|
+
### Default
|
|
161
|
+
|
|
162
|
+
The default switch displays what resembles a physical switch that toggles between an active and inactive state. It is displayed in cozy mode, which is ideal for mobile and small tablet screens. The switch should always be accompanied by a label that indicates its purpose.
|
|
163
|
+
|
|
164
|
+
```html
|
|
165
|
+
<div class="fd-form-group">
|
|
166
|
+
<div class="fd-form-item">
|
|
167
|
+
<div class="fd-form-label" id="label1">Default Switch</div>
|
|
168
|
+
<label class="fd-switch">
|
|
169
|
+
<span class="fd-switch__control">
|
|
170
|
+
<input
|
|
171
|
+
class="fd-switch__input"
|
|
172
|
+
type="checkbox"
|
|
173
|
+
name=""
|
|
174
|
+
value=""
|
|
175
|
+
aria-labelledby="label1"
|
|
176
|
+
id="y21YO3251"
|
|
177
|
+
/>
|
|
178
|
+
<div class="fd-switch__slider">
|
|
179
|
+
<div class="fd-switch__track">
|
|
180
|
+
<i role="presentation" class="fd-switch__icon fd-switch__icon--on sap-icon--accept"></i>
|
|
181
|
+
<span class="fd-switch__handle" role="presentation"></span>
|
|
182
|
+
<i role="presentation" class="fd-switch__icon fd-switch__icon--off sap-icon--less"></i>
|
|
183
|
+
</div>
|
|
184
|
+
</div>
|
|
185
|
+
</span>
|
|
186
|
+
</label>
|
|
187
|
+
</div>
|
|
188
|
+
<div class="fd-form-item">
|
|
189
|
+
<div class="fd-form-label" id="label7">Disabled Switch</div>
|
|
190
|
+
<label class="fd-switch is-disabled">
|
|
191
|
+
<span class="fd-switch__control">
|
|
192
|
+
<input
|
|
193
|
+
class="fd-switch__input"
|
|
194
|
+
type="checkbox"
|
|
195
|
+
name=""
|
|
196
|
+
value=""
|
|
197
|
+
aria-labelledby="label7"
|
|
198
|
+
id="y21Y13431"
|
|
199
|
+
/>
|
|
200
|
+
<div class="fd-switch__slider">
|
|
201
|
+
<div class="fd-switch__track">
|
|
202
|
+
<i role="presentation" class="fd-switch__icon fd-switch__icon--on sap-icon--accept"></i>
|
|
203
|
+
<span class="fd-switch__handle" role="presentation"></span>
|
|
204
|
+
<i role="presentation" class="fd-switch__icon fd-switch__icon--off sap-icon--less"></i>
|
|
205
|
+
</div>
|
|
206
|
+
</div>
|
|
207
|
+
</span>
|
|
208
|
+
</label>
|
|
209
|
+
</div>
|
|
210
|
+
</div>
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
### SemanticSwitch
|
|
214
|
+
|
|
215
|
+
The switch can be displayed with semantic colors, such as green for active and red for inactive. To display a semantic switch, add the \
|
|
216
|
+
|
|
217
|
+
```html
|
|
218
|
+
<div class="fd-form-group">
|
|
219
|
+
<div class="fd-form-item">
|
|
220
|
+
<label class="fd-form-label" id="label5">Semantic switch</label>
|
|
221
|
+
<label class="fd-switch fd-switch--semantic">
|
|
222
|
+
<span class="fd-switch__control">
|
|
223
|
+
<input class="fd-switch__input" type="checkbox" aria-labelledby="label5" name="" value="" id="y21YO3251">
|
|
224
|
+
<div class="fd-switch__slider">
|
|
225
|
+
<div class="fd-switch__track">
|
|
226
|
+
<i role="presentation" class="fd-switch__icon fd-switch__icon--on sap-icon--accept"></i>
|
|
227
|
+
<span class="fd-switch__handle" role="presentation"></span>
|
|
228
|
+
<i role="presentation" class="fd-switch__icon fd-switch__icon--off sap-icon--decline"></i>
|
|
229
|
+
</div>
|
|
230
|
+
</div>
|
|
231
|
+
</span>
|
|
232
|
+
</label>
|
|
233
|
+
</div>
|
|
234
|
+
</div>
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
### Text Switch
|
|
238
|
+
|
|
239
|
+
For technical compatibility reasons, it is also possible – although not advised – to have a switch that contains a text element, instead of an icon. Add the \
|
|
240
|
+
|
|
241
|
+
```html
|
|
242
|
+
<div class="fd-form-group">
|
|
243
|
+
<div class="fd-form-item">
|
|
244
|
+
<div class="fd-form-label" id="label3">Text Switch (off)</div>
|
|
245
|
+
<label class="fd-switch fd-switch--text">
|
|
246
|
+
<span class="fd-switch__control">
|
|
247
|
+
<input class="fd-switch__input" type="checkbox" name="" aria-labelledby="label3" value="" id="y21Y677251">
|
|
248
|
+
<div class="fd-switch__slider">
|
|
249
|
+
<div class="fd-switch__track">
|
|
250
|
+
<span class="fd-switch__text fd-switch__text--on">on</span>
|
|
251
|
+
<span class="fd-switch__handle" role="presentation"></span>
|
|
252
|
+
<span class="fd-switch__text fd-switch__text--off">off</span>
|
|
253
|
+
</div>
|
|
254
|
+
</div>
|
|
255
|
+
</span>
|
|
256
|
+
</label>
|
|
257
|
+
</div>
|
|
258
|
+
<div class="fd-form-item">
|
|
259
|
+
<div class="fd-form-label" id="label4">Text Switch (on)</div>
|
|
260
|
+
<label class="fd-switch fd-switch--text">
|
|
261
|
+
<span class="fd-switch__control">
|
|
262
|
+
<input class="fd-switch__input" checked type="checkbox" aria-labelledby="label4" name="" value="" id="y21653431">
|
|
263
|
+
<div class="fd-switch__slider">
|
|
264
|
+
<div class="fd-switch__track">
|
|
265
|
+
<span class="fd-switch__text fd-switch__text--on">on</span>
|
|
266
|
+
<span class="fd-switch__handle" role="presentation"></span>
|
|
267
|
+
<span class="fd-switch__text fd-switch__text--off">off</span>
|
|
268
|
+
</div>
|
|
269
|
+
</div>
|
|
270
|
+
</span>
|
|
271
|
+
</label>
|
|
272
|
+
</div>
|
|
273
|
+
</div>
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
## Accessibility
|
|
277
|
+
|
|
278
|
+
- Use semantic HTML elements where appropriate
|
|
279
|
+
- Include proper ARIA attributes for interactive elements
|
|
280
|
+
- Ensure keyboard navigation support
|
|
281
|
+
- Provide adequate color contrast
|
|
282
|
+
|
|
283
|
+
## Source
|
|
284
|
+
|
|
285
|
+
This documentation was automatically generated from: `packages/styles/stories/Components/switch/switch.stories.js`
|
|
286
|
+
|
|
287
|
+
For the latest updates and interactive examples, see [Storybook](https://sap.github.io/fundamental-styles/).
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
---
|
|
2
|
+
component: fd-form-header
|
|
3
|
+
title: Components/Forms/Form Header
|
|
4
|
+
category: Components
|
|
5
|
+
selector: fd-form-header
|
|
6
|
+
cssFile: form-header.css
|
|
7
|
+
sourcePath: packages/styles/stories/Components/Forms/form-header/form-header.stories.js
|
|
8
|
+
tags: []
|
|
9
|
+
dependencies: []
|
|
10
|
+
relatedComponents: []
|
|
11
|
+
stability: stable
|
|
12
|
+
generatedAt: 2026-06-09T18:29:01.580Z
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
# Components/Forms/Form Header
|
|
16
|
+
|
|
17
|
+
Form headers are essentially titles that provide users with more context about a group of input fields. For instance, a form header titled with “Personal information” would categorize input fields with labels: “Name, Address, etc.”
|
|
18
|
+
|
|
19
|
+
## Installation
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npm install fundamental-styles
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
```html
|
|
26
|
+
<!-- Include theme -->
|
|
27
|
+
<link href="node_modules/fundamental-styles/dist/theming/sap_horizon.css" rel="stylesheet">
|
|
28
|
+
|
|
29
|
+
<!-- Include component CSS -->
|
|
30
|
+
<link href="node_modules/fundamental-styles/dist/form-header.css" rel="stylesheet">
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Basic Usage
|
|
35
|
+
|
|
36
|
+
```html
|
|
37
|
+
<div class="fd-form-header">
|
|
38
|
+
<h4 class="fd-form-header__text">Form Header</h4>
|
|
39
|
+
</div>
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## BEM Elements
|
|
43
|
+
|
|
44
|
+
This component uses the following BEM elements:
|
|
45
|
+
|
|
46
|
+
- `fd-form-header__text`
|
|
47
|
+
|
|
48
|
+
## Examples
|
|
49
|
+
|
|
50
|
+
### Default
|
|
51
|
+
|
|
52
|
+
Default form headers are displayed in text that does not wrap but truncates into an ellipsis.
|
|
53
|
+
|
|
54
|
+
```html
|
|
55
|
+
<div class="fd-form-header">
|
|
56
|
+
<h4 class="fd-form-header__text">Form Header</h4>
|
|
57
|
+
</div>
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Accessibility
|
|
61
|
+
|
|
62
|
+
- Use semantic HTML elements where appropriate
|
|
63
|
+
- Include proper ARIA attributes for interactive elements
|
|
64
|
+
- Ensure keyboard navigation support
|
|
65
|
+
- Provide adequate color contrast
|
|
66
|
+
|
|
67
|
+
## Source
|
|
68
|
+
|
|
69
|
+
This documentation was automatically generated from: `packages/styles/stories/Components/Forms/form-header/form-header.stories.js`
|
|
70
|
+
|
|
71
|
+
For the latest updates and interactive examples, see [Storybook](https://sap.github.io/fundamental-styles/).
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
---
|
|
2
|
+
component: fd-form-item
|
|
3
|
+
title: Components/Forms/Form Item
|
|
4
|
+
category: Components
|
|
5
|
+
selector: fd-form-item
|
|
6
|
+
cssFile: form-item.css
|
|
7
|
+
sourcePath: packages/styles/stories/Components/Forms/form-item/form-item.stories.js
|
|
8
|
+
tags: []
|
|
9
|
+
dependencies: []
|
|
10
|
+
relatedComponents: []
|
|
11
|
+
stability: stable
|
|
12
|
+
generatedAt: 2026-06-09T18:29:01.537Z
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
# Components/Forms/Form Item
|
|
16
|
+
|
|
17
|
+
A form item is a combination of a label and an input field. The label clearly describes the expected input, and is associated with the input for accessibility.
|
|
18
|
+
|
|
19
|
+
## Installation
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npm install fundamental-styles
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
```html
|
|
26
|
+
<!-- Include theme -->
|
|
27
|
+
<link href="node_modules/fundamental-styles/dist/theming/sap_horizon.css" rel="stylesheet">
|
|
28
|
+
|
|
29
|
+
<!-- Include component CSS -->
|
|
30
|
+
<link href="node_modules/fundamental-styles/dist/form-item.css" rel="stylesheet">
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Basic Usage
|
|
35
|
+
|
|
36
|
+
```html
|
|
37
|
+
<div class="fd-form-item">
|
|
38
|
+
<label class="fd-form-label" for="default-input">Full Name:</label>
|
|
39
|
+
<input
|
|
40
|
+
class="fd-input"
|
|
41
|
+
type="text"
|
|
42
|
+
id="default-input"
|
|
43
|
+
name="full-name"
|
|
44
|
+
placeholder="e.g., Jane Doe"
|
|
45
|
+
autocomplete="name">
|
|
46
|
+
</div>
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Examples
|
|
50
|
+
|
|
51
|
+
### Default
|
|
52
|
+
|
|
53
|
+
Use the default form item when the input is optional and does not require additional validation or indication.
|
|
54
|
+
|
|
55
|
+
```html
|
|
56
|
+
<div class="fd-form-item">
|
|
57
|
+
<label class="fd-form-label" for="default-input">Full Name:</label>
|
|
58
|
+
<input
|
|
59
|
+
class="fd-input"
|
|
60
|
+
type="text"
|
|
61
|
+
id="default-input"
|
|
62
|
+
name="full-name"
|
|
63
|
+
placeholder="e.g., Jane Doe"
|
|
64
|
+
autocomplete="name">
|
|
65
|
+
</div>
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Required
|
|
69
|
+
|
|
70
|
+
To mark an input as required, use the <code>fd-form-label--required</code> modifier. Also set <code>aria-required="true"</code> on the input to ensure screen readers announce the requirement.
|
|
71
|
+
|
|
72
|
+
```html
|
|
73
|
+
<div class="fd-form-item">
|
|
74
|
+
<label class="fd-form-label fd-form-label--required" for="required-email">Email Address:</label>
|
|
75
|
+
<input
|
|
76
|
+
class="fd-input"
|
|
77
|
+
type="email"
|
|
78
|
+
id="required-email"
|
|
79
|
+
name="email"
|
|
80
|
+
placeholder="e.g., user@example.com"
|
|
81
|
+
autocomplete="email"
|
|
82
|
+
required
|
|
83
|
+
aria-required="true">
|
|
84
|
+
</div>
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Accessibility
|
|
88
|
+
|
|
89
|
+
- Use semantic HTML elements where appropriate
|
|
90
|
+
- Include proper ARIA attributes for interactive elements
|
|
91
|
+
- Ensure keyboard navigation support
|
|
92
|
+
- Provide adequate color contrast
|
|
93
|
+
|
|
94
|
+
## Source
|
|
95
|
+
|
|
96
|
+
This documentation was automatically generated from: `packages/styles/stories/Components/Forms/form-item/form-item.stories.js`
|
|
97
|
+
|
|
98
|
+
For the latest updates and interactive examples, see [Storybook](https://sap.github.io/fundamental-styles/).
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
---
|
|
2
|
+
component: fd-form-item
|
|
3
|
+
title: Components/Forms/Form Label
|
|
4
|
+
category: Components
|
|
5
|
+
selector: fd-form-item
|
|
6
|
+
cssFile: form-item.css
|
|
7
|
+
sourcePath: packages/styles/stories/Components/Forms/form-label/form-label.stories.js
|
|
8
|
+
tags: []
|
|
9
|
+
dependencies: []
|
|
10
|
+
relatedComponents: []
|
|
11
|
+
stability: stable
|
|
12
|
+
generatedAt: 2026-06-09T18:29:01.566Z
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
# Components/Forms/Form Label
|
|
16
|
+
|
|
17
|
+
Form labels are used to identify form elements such as input fields, checkboxes and radio buttons. This component is best used as a child element of the **Form Item** component.
|
|
18
|
+
|
|
19
|
+
## Installation
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npm install fundamental-styles
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
```html
|
|
26
|
+
<!-- Include theme -->
|
|
27
|
+
<link href="node_modules/fundamental-styles/dist/theming/sap_horizon.css" rel="stylesheet">
|
|
28
|
+
|
|
29
|
+
<!-- Include component CSS -->
|
|
30
|
+
<link href="node_modules/fundamental-styles/dist/form-item.css" rel="stylesheet">
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Basic Usage
|
|
35
|
+
|
|
36
|
+
```html
|
|
37
|
+
<div class="fd-form-item">
|
|
38
|
+
<label class="fd-form-label" for="default-input">Full Name</label>
|
|
39
|
+
<input
|
|
40
|
+
class="fd-input"
|
|
41
|
+
type="text"
|
|
42
|
+
id="default-input"
|
|
43
|
+
name="full-name"
|
|
44
|
+
placeholder="e.g., Jane Doe"
|
|
45
|
+
autocomplete="name">
|
|
46
|
+
</div>
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Examples
|
|
50
|
+
|
|
51
|
+
### Default
|
|
52
|
+
|
|
53
|
+
Use the default form label when the field is optional and does not require special styling or behavior.
|
|
54
|
+
|
|
55
|
+
```html
|
|
56
|
+
<div class="fd-form-item">
|
|
57
|
+
<label class="fd-form-label" for="default-input">Full Name</label>
|
|
58
|
+
<input
|
|
59
|
+
class="fd-input"
|
|
60
|
+
type="text"
|
|
61
|
+
id="default-input"
|
|
62
|
+
name="full-name"
|
|
63
|
+
placeholder="e.g., Jane Doe"
|
|
64
|
+
autocomplete="name">
|
|
65
|
+
</div>
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Required
|
|
69
|
+
|
|
70
|
+
To visually and programmatically indicate a required field, add the <code>fd-form-label--required</code> modifier to the label and use the <code>required</code> and <code>aria-required="true"</code> attributes on the input.
|
|
71
|
+
|
|
72
|
+
```html
|
|
73
|
+
<div class="fd-form-item">
|
|
74
|
+
<label class="fd-form-label fd-form-label--required" for="required-email">Email Address</label>
|
|
75
|
+
<input
|
|
76
|
+
class="fd-input"
|
|
77
|
+
type="email"
|
|
78
|
+
id="required-email"
|
|
79
|
+
name="email"
|
|
80
|
+
placeholder="e.g., user@example.com"
|
|
81
|
+
autocomplete="email"
|
|
82
|
+
required
|
|
83
|
+
aria-required="true">
|
|
84
|
+
</div>
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### Colon
|
|
88
|
+
|
|
89
|
+
To display a label with a colon, add the <code>fd-form-label--colon</code> modifier.
|
|
90
|
+
|
|
91
|
+
```html
|
|
92
|
+
<div class="fd-form-item">
|
|
93
|
+
<label class="fd-form-label fd-form-label--colon" for="input-with-colon">Job Title</label>
|
|
94
|
+
<input
|
|
95
|
+
class="fd-input"
|
|
96
|
+
type="text"
|
|
97
|
+
id="input-with-colon"
|
|
98
|
+
name="job-title"
|
|
99
|
+
placeholder="e.g., Software Engineer">
|
|
100
|
+
</div>
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### Disabled
|
|
104
|
+
|
|
105
|
+
There are 3 ways to visually show that a label is disabled:
|
|
106
|
+
1. Add <code>aria-disabled="true"</code>. This communicates to assistive technologies (like screen readers) that the label is representing a disabled UI element.
|
|
107
|
+
2. Add <code>is-disabled</code> class to <code>fd-form-label</code> class.
|
|
108
|
+
3. Add <code>fd-form-label--disabled</code> modifier class to <code>fd-form-label</code> class.
|
|
109
|
+
|
|
110
|
+
```html
|
|
111
|
+
<div class="fd-form-item">
|
|
112
|
+
<label class="fd-form-label" for="disabled-input" aria-disabled="true">Organization</label>
|
|
113
|
+
<input
|
|
114
|
+
class="fd-input"
|
|
115
|
+
type="text"
|
|
116
|
+
id="disabled-input"
|
|
117
|
+
name="organization"
|
|
118
|
+
value="SAP"
|
|
119
|
+
disabled>
|
|
120
|
+
</div>
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## Accessibility
|
|
124
|
+
|
|
125
|
+
- Use semantic HTML elements where appropriate
|
|
126
|
+
- Include proper ARIA attributes for interactive elements
|
|
127
|
+
- Ensure keyboard navigation support
|
|
128
|
+
- Provide adequate color contrast
|
|
129
|
+
|
|
130
|
+
## Source
|
|
131
|
+
|
|
132
|
+
This documentation was automatically generated from: `packages/styles/stories/Components/Forms/form-label/form-label.stories.js`
|
|
133
|
+
|
|
134
|
+
For the latest updates and interactive examples, see [Storybook](https://sap.github.io/fundamental-styles/).
|