File tree Expand file tree Collapse file tree 1 file changed +20
-3
lines changed
src/components/NcFormGroup Expand file tree Collapse file tree 1 file changed +20
-3
lines changed Original file line number Diff line number Diff line change @@ -39,11 +39,11 @@ const props = withDefaults(defineProps<{
3939const slots = useSlots ()
4040
4141const id = ` nc-form-group-${createElementId ()} `
42- const labelId = ` ${id }-label `
4342const descriptionId = ` ${id }-description `
4443
4544const hasDescription = () => !! props .description || !! slots .description
4645const getDescriptionId = () => hasDescription () ? descriptionId : undefined
46+ const hasContentOnly = () => hideLabel && (! hasDescription () || hideDescription )
4747 </script >
4848
4949<template >
@@ -95,8 +95,7 @@ const getDescriptionId = () => hasDescription() ? descriptionId : undefined
9595 flex-direction : column ;
9696 gap : var (--form-group-content-gap );
9797 margin-block-start : calc (4 * var (--default-grid-baseline ));
98-
99- & :first-child {
98+ & .formGroup__content_only {
10099 margin-block-start : 0 ;
101100 }
102101}
@@ -126,4 +125,22 @@ Labelled group of form elements.
126125 </NcFormGroup>
127126</template>
128127```
128+
129+ ### Hidden label/description
130+
131+ You can visually hide the label and/or the description.\
132+ Note: you still must provide the label. Do not visually hide the missing label warning!
133+
134+ ```vue
135+ <template>
136+ <NcFormGroup
137+ label="Personal information"
138+ description="Your contact details"
139+ hide-label
140+ hide-description>
141+ <NcTextField label="First name" />
142+ <NcTextField label="Last name" />
143+ </NcFormGroup>
144+ </template>
145+ ```
129146</docs >
You can’t perform that action at this time.
0 commit comments