File tree Expand file tree Collapse file tree 4 files changed +35
-0
lines changed
Expand file tree Collapse file tree 4 files changed +35
-0
lines changed Original file line number Diff line number Diff line change 5454 }
5555 }
5656
57+ & --no-margin {
58+ margin : 0 ;
59+ }
60+
5761 & __helper-text {
5862 @include synth-font-type-20 ;
5963 color : var (--ux-gray-900 );
Original file line number Diff line number Diff line change @@ -42,6 +42,12 @@ be beneficial to the user
4242
4343<Canvas of = { ComponentStories .Required } />
4444
45+ ### No margin
46+
47+ - Remove the default margin on the FormGroup.
48+
49+ <Canvas of = { ComponentStories .NoMargin } />
50+
4551### With Label Tooltip
4652
4753- Information users will typically only reference once (and then it's learned) or here and there.
Original file line number Diff line number Diff line change 11import React , { useState } from 'react' ;
22import { faSearch } from '@fortawesome/pro-solid-svg-icons' ;
33
4+ import { FlexContainer } from 'src/FlexContainer' ;
45import FormGroup from '.' ;
56import Input from '../Input' ;
67import FormControlLabel from '../FormControlLabel' ;
@@ -56,6 +57,27 @@ export const Required = () => (
5657 </ FormGroup >
5758) ;
5859
60+ export const NoMargin = ( ) => (
61+ < FlexContainer flexDirection = "column" gap = { 4 } >
62+ < FormGroup
63+ label = "Label"
64+ labelHtmlFor = "no-margin-1-input"
65+ noMargin
66+ required
67+ >
68+ < InputComponent id = "no-margin-1-input" placeholder = "This FormGroup has no default margin" />
69+ </ FormGroup >
70+ < FormGroup
71+ label = "Label"
72+ labelHtmlFor = "no-margin-2-input"
73+ noMargin
74+ required
75+ >
76+ < InputComponent id = "no-margin-2-input" placeholder = "This FormGroup has no default margin" />
77+ </ FormGroup >
78+ </ FlexContainer >
79+ ) ;
80+
5981export const WithLabelTooltip = ( ) => (
6082 < FormGroup
6183 id = "with-label"
Original file line number Diff line number Diff line change @@ -57,6 +57,7 @@ export type FormGroupProps = {
5757 labelHelperText ?: string ;
5858 labelHtmlFor ?: string ;
5959 labelTooltip ?: React . ReactNode ;
60+ noMargin ?: boolean ;
6061 required ?: boolean ;
6162} ;
6263
@@ -76,6 +77,7 @@ export default function FormGroup({
7677 labelHelperText,
7778 labelHtmlFor = '' ,
7879 labelTooltip,
80+ noMargin,
7981 required,
8082} : FormGroupProps ) {
8183 const errorMessage = buildErrorMessage ( errors [ inputKey || '' ] , label ) ;
@@ -137,6 +139,7 @@ export default function FormGroup({
137139 'FormGroup--is-invalid' : hasErrors ,
138140 'FormGroup--bordered' : bordered ,
139141 'FormGroup--inline' : inline ,
142+ 'FormGroup--no-margin' : noMargin ,
140143 } ,
141144 ) ,
142145 id,
You can’t perform that action at this time.
0 commit comments