Checkbox Group

Structure

The checkbox group component is structured with a fieldset/legend element, for a11y concerns.

<!-- Default -->
<fieldset class="sds-checkboxGroup sds-stackLg">
    <legend>
        <div class="sds-label -labelForm">
            Label

        </div>
    </legend>
    <ul class="list-unstyled">

        <li class="form-group">
            <div class="sds-checkbox custom-control custom-checkbox">
                <input value="checkbox-value" type="checkbox" name="" class="sr-only custom-control-input " id="default"><span class="sds-checkboxDot sds-checkbox__shape" aria-hidden="true"></span>
                <label class="custom-control-label" for="default">Check this custom checkbox</label>

                <div class="sds-checkbox__error invalid-feedback">Error message</div>
            </div>
        </li>

        <li class="form-group">
            <div class="sds-checkbox custom-control custom-checkbox">
                <input value="checkbox-value" type="checkbox" name="" class="sr-only custom-control-input " id="default"><span class="sds-checkboxDot sds-checkbox__shape" aria-hidden="true"></span>
                <label class="custom-control-label" for="default">Check this custom checkbox</label>

                <div class="sds-checkbox__error invalid-feedback">Error message</div>
            </div>
        </li>

        <li class="form-group">
            <div class="sds-checkbox custom-control custom-checkbox">
                <input value="checkbox-value" type="checkbox" name="" class="sr-only custom-control-input " id="default"><span class="sds-checkboxDot sds-checkbox__shape" aria-hidden="true"></span>
                <label class="custom-control-label" for="default">Check this custom checkbox</label>

                <div class="sds-checkbox__error invalid-feedback">Error message</div>
            </div>
        </li>

        <li class="form-group">
            <div class="sds-checkbox custom-control custom-checkbox">
                <input value="checkbox-value" type="checkbox" name="" class="sr-only custom-control-input " id="default"><span class="sds-checkboxDot sds-checkbox__shape" aria-hidden="true"></span>
                <label class="custom-control-label" for="default">Check this custom checkbox</label>

                <div class="sds-checkbox__error invalid-feedback">Error message</div>
            </div>
        </li>

        <li class="form-group">
            <div class="sds-checkbox custom-control custom-checkbox">
                <input value="checkbox-value" type="checkbox" name="" class="sr-only custom-control-input " id="default"><span class="sds-checkboxDot sds-checkbox__shape" aria-hidden="true"></span>
                <label class="custom-control-label" for="default">Check this custom checkbox</label>

                <div class="sds-checkbox__error invalid-feedback">Error message</div>
            </div>
        </li>

    </ul>

    <p class="sds-checkboxGroup__error invalid-feedback">Error message</p>
</fieldset>

<!-- Group Error -->
<fieldset class="sds-checkboxGroup sds-stackLg">
    <legend>
        <div class="sds-label -labelForm">
            Label

        </div>
    </legend>
    <ul class="list-unstyled is-invalid">

        <li class="form-group">
            <div class="sds-checkbox custom-control custom-checkbox">
                <input value="checkbox-value" type="checkbox" name="" class="sr-only custom-control-input " id="default"><span class="sds-checkboxDot sds-checkbox__shape" aria-hidden="true"></span>
                <label class="custom-control-label" for="default">Check this custom checkbox</label>

                <div class="sds-checkbox__error invalid-feedback">Error message</div>
            </div>
        </li>

        <li class="form-group">
            <div class="sds-checkbox custom-control custom-checkbox">
                <input value="checkbox-value" type="checkbox" name="" class="sr-only custom-control-input " id="default"><span class="sds-checkboxDot sds-checkbox__shape" aria-hidden="true"></span>
                <label class="custom-control-label" for="default">Check this custom checkbox</label>

                <div class="sds-checkbox__error invalid-feedback">Error message</div>
            </div>
        </li>

        <li class="form-group">
            <div class="sds-checkbox custom-control custom-checkbox">
                <input value="checkbox-value" type="checkbox" name="" class="sr-only custom-control-input " id="default"><span class="sds-checkboxDot sds-checkbox__shape" aria-hidden="true"></span>
                <label class="custom-control-label" for="default">Check this custom checkbox</label>

                <div class="sds-checkbox__error invalid-feedback">Error message</div>
            </div>
        </li>

        <li class="form-group">
            <div class="sds-checkbox custom-control custom-checkbox">
                <input value="checkbox-value" type="checkbox" name="" class="sr-only custom-control-input " id="default"><span class="sds-checkboxDot sds-checkbox__shape" aria-hidden="true"></span>
                <label class="custom-control-label" for="default">Check this custom checkbox</label>

                <div class="sds-checkbox__error invalid-feedback">Error message</div>
            </div>
        </li>

        <li class="form-group">
            <div class="sds-checkbox custom-control custom-checkbox">
                <input value="checkbox-value" type="checkbox" name="" class="sr-only custom-control-input " id="default"><span class="sds-checkboxDot sds-checkbox__shape" aria-hidden="true"></span>
                <label class="custom-control-label" for="default">Check this custom checkbox</label>

                <div class="sds-checkbox__error invalid-feedback">Error message</div>
            </div>
        </li>

    </ul>

    <p class="sds-checkboxGroup__error invalid-feedback">Error message</p>
</fieldset>

<!-- Group Hint -->
<fieldset class="sds-checkboxGroup sds-stackLg">
    <legend>
        <div class="sds-label -labelForm">
            Label

        </div>
    </legend>
    <ul class="list-unstyled">

        <li class="form-group">
            <div class="sds-checkbox custom-control custom-checkbox">
                <input value="checkbox-value" type="checkbox" name="" class="sr-only custom-control-input " id="default"><span class="sds-checkboxDot sds-checkbox__shape" aria-hidden="true"></span>
                <label class="custom-control-label" for="default">Check this custom checkbox</label>

                <div class="sds-checkbox__error invalid-feedback">Error message</div>
            </div>
        </li>

        <li class="form-group">
            <div class="sds-checkbox custom-control custom-checkbox">
                <input value="checkbox-value" type="checkbox" name="" class="sr-only custom-control-input " id="default"><span class="sds-checkboxDot sds-checkbox__shape" aria-hidden="true"></span>
                <label class="custom-control-label" for="default">Check this custom checkbox</label>

                <div class="sds-checkbox__error invalid-feedback">Error message</div>
            </div>
        </li>

        <li class="form-group">
            <div class="sds-checkbox custom-control custom-checkbox">
                <input value="checkbox-value" type="checkbox" name="" class="sr-only custom-control-input " id="default"><span class="sds-checkboxDot sds-checkbox__shape" aria-hidden="true"></span>
                <label class="custom-control-label" for="default">Check this custom checkbox</label>

                <div class="sds-checkbox__error invalid-feedback">Error message</div>
            </div>
        </li>

        <li class="form-group">
            <div class="sds-checkbox custom-control custom-checkbox">
                <input value="checkbox-value" type="checkbox" name="" class="sr-only custom-control-input " id="default"><span class="sds-checkboxDot sds-checkbox__shape" aria-hidden="true"></span>
                <label class="custom-control-label" for="default">Check this custom checkbox</label>

                <div class="sds-checkbox__error invalid-feedback">Error message</div>
            </div>
        </li>

        <li class="form-group">
            <div class="sds-checkbox custom-control custom-checkbox">
                <input value="checkbox-value" type="checkbox" name="" class="sr-only custom-control-input " id="default"><span class="sds-checkboxDot sds-checkbox__shape" aria-hidden="true"></span>
                <label class="custom-control-label" for="default">Check this custom checkbox</label>

                <div class="sds-checkbox__error invalid-feedback">Error message</div>
            </div>
        </li>

    </ul>

    <p class="sds-checkboxGroup__hint sds-textHelperSmall">Checkbox hint</p>

    <p class="sds-checkboxGroup__error invalid-feedback">Error message</p>
</fieldset>

<fieldset class="{{ namespace }}checkboxGroup {{ namespace }}stackLg{% for mod in modifiers %} {{ mod }}{% endfor %}{% for mod in classes %} {{ mod }}{% endfor %}">
	<legend>
		{% render "@label--form",{
			eltType: "div",
			text: labelText
		}, true %}
	</legend>
	<ul class="list-unstyled{% if groupErrorClass %} {{ groupErrorClass }}{% endif %}">
		{% for i in range(0,5) %}
			<li class="form-group">
				{% render "@checkbox",{state: checkboxErrorState} ,true %}
			</li>
		{% endfor %}
	</ul>
	{% if hint %}
		<p class="{{ namespace }}checkboxGroup__hint {{ namespace }}textHelperSmall">Checkbox hint</p>
	{% endif %}
	<p class="{{ namespace }}checkboxGroup__error invalid-feedback">Error message</p>
</fieldset>
  • Content:
    /* variables specific to current element */
    
    $element-specific-variables: "";
    
    .#{$namespace}checkboxGroup {
    
    	/* Save root element context for easy access if nesting is needed */
    
    	$self: &;
    
    	/* properties of current element  + media queries */
    
    
    	/* Pseudo Elements */
    
    	&::before {
    	}
    
    	&::after {
    	}
    
    	/*
    	Include elements that are linked to the current element but have to reside at the root level of the stylesheet
    	(e.g: keyframes)
    	*/
    	@at-root {
    	}
    
    
    	/* children - write selector in full in comments in order to facilitate search */
    
    	// checkboxGroup__childElement
    	&__error,
    	&__hint {
    
    		margin-top: 0;
    		padding-left: $custom-control-label-shape-space;
    
    	}
    
    	&__hint {
    
    		@include custom-prop-fallback("color", "sys-color-text-primary-muted");
    
    	}
    
    
    	/* modifiers */
    
    	// checkboxGroup -altStyle
    	&.-altStyle {
    
    		// follows same logic as base element
    
    	}
    
    	/* random parent element */
    	/* 
    	*
    	*   Syntax : .randomParentElt & {}
    	*
    	*/
    
    	/* Pseudo Classes */
    
    	&:hover {
    		@media (hover: hover) {
    
    		}
    	}
    
    	&:focus {
    	}
    
    	&:active {
    	}
    
    	&:focus,
    	&:active {
    	}
    
    }
  • URL: /components/raw/checkbox-group/_checkbox-group.scss
  • Filesystem Path: components/base-components/molecules/forms/checkbox-group/_checkbox-group.scss
  • Size: 1.1 KB