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
* The form component is used for aligning multiple inputs and field groups within a form.
12
+
* The form component is used for aligning multiple inputs and field groups within a form. It provides structure and spacing for your form fields.
10
13
*/
11
14
exportdefault{
12
15
title: "Form",
13
16
component: "Form",
14
17
argTypes: {
15
-
labelsAbove: {
16
-
name: "Labels above",
17
-
type: {name: "boolean"},
18
+
labelPosition: {
19
+
name: "Label position",
20
+
description: "Position of the field label in relation to the input.",
21
+
type: {name: "string"},
18
22
table: {
19
-
type: {summary: "boolean"},
23
+
type: {summary: "string"},
20
24
category: "Component",
21
25
},
22
-
control: "boolean",
26
+
control: "select",
27
+
options: ["top","side"],
23
28
},
29
+
fieldLabelAlignment: {
30
+
name: "Field label alignment",
31
+
type: {name: "string"},
32
+
table: {
33
+
type: {summary: "string"},
34
+
category: "Component",
35
+
},
36
+
control: "select",
37
+
options: ["left","right"],
38
+
if: {arg: "labelPosition",eq: "side"},
39
+
},
40
+
items: {table: {disable: true}},
24
41
},
25
42
args: {
26
43
rootClass: "spectrum-Form",
27
-
labelsAbove: false,
44
+
labelPosition: "top",
28
45
},
29
46
parameters: {
30
47
packageJson: pkgJson,
31
48
},
32
49
};
33
50
51
+
/**
52
+
* 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
+
*/
34
54
exportconstDefault=FormGroup.bind({});
35
55
Default.args={
36
56
items: [
@@ -65,7 +85,26 @@ Default.args = {
65
85
},context),
66
86
],
67
87
},{
68
-
label: "Amount",
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",
69
108
id: "form-example-amount",
70
109
content: [
71
110
(passthroughs,context)=>Stepper({
@@ -76,6 +115,35 @@ Default.args = {
76
115
],
77
116
};
78
117
118
+
/**
119
+
* A two column layout with left-aligned label text.
LeftAlignedSideLabels.storyName="Left-aligned side labels";
131
+
132
+
/**
133
+
* A two column layout with right-aligned label text. `.spectrum-FieldLabel--right` is applied to each to each [field label](/docs/components-field-label--docs).
0 commit comments