You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- added documentation around the "necessity indicator" being text
- included a required state for the wrapping/truncation test changes
- set default args for form items
* Field labels for required inputs can be marked with an asterisk at the end of the label. Optional inputs would then be understood to not have the asterisk. If using the asterisk icon, do not leave any space between the label text and the start of the `<svg>` element in the markup. Extra space should not be added in addition to the inline margin.
97
+
*
98
+
* The field label for a required field can display either the text “(required)”, or an asterisk.
Copy file name to clipboardExpand all lines: components/fieldlabel/stories/form.stories.js
+61-62Lines changed: 61 additions & 62 deletions
Original file line number
Diff line number
Diff line change
@@ -42,6 +42,66 @@ export default {
42
42
args: {
43
43
rootClass: "spectrum-Form",
44
44
labelPosition: "top",
45
+
items: [
46
+
{
47
+
label: "Company title",
48
+
id: "form-example-company",
49
+
content: [
50
+
(passthroughs,context)=>TextField({
51
+
...passthroughs,
52
+
multiline: true,
53
+
name: "field",
54
+
},context),
55
+
],
56
+
},{
57
+
label: "Email address",
58
+
id: "form-example-email",
59
+
content: [
60
+
(passthroughs,context)=>TextField({
61
+
...passthroughs,
62
+
type: "email",
63
+
name: "email",
64
+
},context),
65
+
],
66
+
},{
67
+
label: "Country",
68
+
id: "form-example-country",
69
+
content: [
70
+
(passthroughs,context)=>Picker({
71
+
...passthroughs,
72
+
placeholder: "Select a country",
73
+
name: "country",
74
+
},context),
75
+
],
76
+
},{
77
+
label: "Interest",
78
+
id: "form-example-interests",
79
+
content: [
80
+
(passthroughs,context)=>Fieldgroup({
81
+
layout: "horizontal",
82
+
items: [
83
+
Checkbox({
84
+
...passthroughs,
85
+
label: "Kittens",
86
+
customClasses: ["spectrum-FieldGroup-item"],
87
+
},context),
88
+
Checkbox({
89
+
...passthroughs,
90
+
label: "Puppies",
91
+
customClasses: ["spectrum-FieldGroup-item"],
92
+
},context),]
93
+
}),
94
+
],
95
+
},{
96
+
label: "Age",
97
+
id: "form-example-amount",
98
+
content: [
99
+
(passthroughs,context)=>Stepper({
100
+
...passthroughs,
101
+
},context),
102
+
]
103
+
}
104
+
],
45
105
},
46
106
parameters: {
47
107
packageJson: pkgJson,
@@ -52,68 +112,7 @@ export default {
52
112
* A stacked layout with the labels above the form fields. The class `.spectrum-Form--labelPosition` is applied to the form itself. You do not need to apply a specific class to the field label because `.spectrum-FieldLabel--left` is applied to each to each [field label](/docs/components-field-label--docs) by default.
53
113
*/
54
114
exportconstDefault=FormGroup.bind({});
55
-
Default.args={
56
-
items: [
57
-
{
58
-
label: "Company title",
59
-
id: "form-example-company",
60
-
content: [
61
-
(passthroughs,context)=>TextField({
62
-
...passthroughs,
63
-
multiline: true,
64
-
name: "field",
65
-
},context),
66
-
],
67
-
},{
68
-
label: "Email address",
69
-
id: "form-example-email",
70
-
content: [
71
-
(passthroughs,context)=>TextField({
72
-
...passthroughs,
73
-
type: "email",
74
-
name: "email",
75
-
},context),
76
-
],
77
-
},{
78
-
label: "Country",
79
-
id: "form-example-country",
80
-
content: [
81
-
(passthroughs,context)=>Picker({
82
-
...passthroughs,
83
-
placeholder: "Select a country",
84
-
name: "country",
85
-
},context),
86
-
],
87
-
},{
88
-
label: "Interest",
89
-
id: "form-example-interests",
90
-
content: [
91
-
(passthroughs,context)=>Fieldgroup({
92
-
layout: "horizontal",
93
-
items: [
94
-
Checkbox({
95
-
...passthroughs,
96
-
label: "Kittens",
97
-
customClasses: ["spectrum-FieldGroup-item"],
98
-
},context),
99
-
Checkbox({
100
-
...passthroughs,
101
-
label: "Puppies",
102
-
customClasses: ["spectrum-FieldGroup-item"],
103
-
},context),]
104
-
}),
105
-
],
106
-
},{
107
-
label: "Age",
108
-
id: "form-example-amount",
109
-
content: [
110
-
(passthroughs,context)=>Stepper({
111
-
...passthroughs,
112
-
},context),
113
-
]
114
-
}
115
-
],
116
-
};
115
+
Default.args={};
117
116
118
117
/**
119
118
* A two column layout with left-aligned label text.
0 commit comments