Forms ​

This module provides the base styles for form components, such as inputs, textareas, selects, labels, and fieldsets.

Note

Form elements and inputs alone are only a portion of Graupl's feature set for forms. For a complete setup of labels, form items, and help text please see the Input Group component.

Base elements ​

The base <input>, <textarea>, <select>, <fieldset>, <legend>, and <label> elements are styled by default with no need for classes.

Text input ​

Checkbox ​

Radio ​

Text area ​

Fieldsets ​

Variants ​

By default, there are no variants available for forms.

If you are compiling your own version of Graupl, you can set the $themeable variable to true to enable variants.

Custom Properties ​

The following custom properties can be used to customize the form components:

PropertyDescriptionDefault Value
--graupl-input-padding-xThe horizontal padding for input components.var(--graupl-spacer-5)
--graupl-input-padding-yThe vertical padding for input components.var(--graupl-spacer-3)
--graupl-input-paddingThe padding for input components (combines x and y padding).var(--graupl-input-padding-y) var(--graupl-input-padding-x)
--graupl-input-font-sizeThe font size for input components.var(--graupl-font-size-base)
--graupl-label-font-sizeThe font size for label components.var(--graupl-input-font-size)
--graupl-fieldset-directionThe direction of fieldset items- controls the flex-direction property.column
--graupl-fieldset-gapThe gap between fieldset items.var(--graupl-spacer-2)
--graupl-fieldset-padding-xThe horizontal padding for fieldset components.var(--graupl-input-padding-x)
--graupl-fieldset-padding-yThe vertical padding for fieldset components.var(--graupl-input-padding-y)
--graupl-fieldset-paddingThe padding for fieldset components (combines x and y padding).var(--graupl-fieldset-padding-y) var(--graupl-fieldset-padding-x)
--graupl-fieldset-font-sizeThe font size for fieldset components.var(--graupl-input-font-size)
--graupl-input-backgroundThe background color for input components.var(--graupl-background)
--graupl-fieldset-backgroundThe background color for fieldset components.var(--graupl-input-background)
--graupl-input-colorThe text color for input components.var(--graupl-color)
--graupl-input-placeholder-colorThe placeholder text color for input components.var(--graupl-theme-active--secondary--600)
--graupl-label-colorThe text color for label components.var(--graupl-input-color)
--graupl-fieldset-colorThe text color for fieldset components.var(--graupl-input-color)
--graupl-input-disabled-colorThe text color for disabled input components.var(--graupl-theme-active--secondary--400)
--graupl-input-placeholder-disabled-colorThe placeholder text color for disabled input components.var(--graupl-input-disabled-color)
--graupl-label-disabled-colorThe text color for labels for disabled components.var(--graupl-input-disabled-color)
--graupl-fieldset-disabled-colorThe text color for disabled fieldset components.var(--graupl-input-disabled-color)
--graupl-input-border-top-widthThe top border width for input components.var(--graupl-border-top-width)
--graupl-input-border-right-widthThe right border width for input components.var(--graupl-border-right-width)
--graupl-input-border-bottom-widthThe bottom border width for input components.var(--graupl-border-bottom-width)
--graupl-input-border-left-widthThe left border width for input components.var(--graupl-border-left-width)
--graupl-input-border-widthThe border width for input components (combines top, right, bottom, and left widths).var(--graupl-input-border-top-width) var(--graupl-input-border-right-width) var(--graupl-input-border-bottom-width) var(--graupl-input-border-left-width)
--graupl-input-border-top-styleThe top border style for input components.var(--graupl-border-top-style)
--graupl-input-border-right-styleThe right border style for input components.var(--graupl-border-right-style)
--graupl-input-border-bottom-styleThe bottom border style for input components.var(--graupl-border-bottom-style)
--graupl-input-border-left-styleThe left border style for input components.var(--graupl-border-left-style)
--graupl-input-border-styleThe border style for input components (combines top, right, bottom, and left styles).var(--graupl-input-border-top-style) var(--graupl-input-border-right-style) var(--graupl-input-border-bottom-style) var(--graupl-input-border-left-style)
--graupl-input-border-top-left-radiusThe top-left border radius for input components.var(--graupl-border-top-left-radius)
--graupl-input-border-top-right-radiusThe top-right border radius for input components.var(--graupl-border-top-right-radius)
--graupl-input-border-bottom-right-radiusThe bottom-right border radius for input components.var(--graupl-border-bottom-right-radius)
--graupl-input-border-bottom-left-radiusThe bottom-left border radius for input components.var(--graupl-border-bottom-left-radius)
--graupl-input-border-radiusThe border radius for input components (combines top-left, top-right, bottom-right, and bottom-left radii).var(--graupl-input-border-top-left-radius) var(--graupl-input-border-top-right-radius) var(--graupl-input-border-bottom-right-radius) var(--graupl-input-border-bottom-left-radius)
--graupl-fieldset-border-top-widthThe top border width for fieldset components.var(--graupl-input-border-top-width)
--graupl-fieldset-border-right-widthThe right border width for fieldset components.var(--graupl-input-border-right-width)
--graupl-fieldset-border-bottom-widthThe bottom border width for fieldset components.var(--graupl-input-border-bottom-width)
--graupl-fieldset-border-left-widthThe left border width for fieldset components.var(--graupl-input-border-left-width)
--graupl-fieldset-border-widthThe border width for fieldset components (combines top, right, bottom, and left widths).var(--graupl-fieldset-border-top-width) var(--graupl-fieldset-border-right-width) var(--graupl-fieldset-border-bottom-width) var(--graupl-fieldset-border-left-width)
--graupl-fieldset-border-top-styleThe top border style for fieldset components.var(--graupl-input-border-top-style)
--graupl-fieldset-border-right-styleThe right border style for fieldset components.var(--graupl-input-border-right-style)
--graupl-fieldset-border-bottom-styleThe bottom border style for fieldset components.var(--graupl-input-border-bottom-style)
--graupl-fieldset-border-left-styleThe left border style for fieldset components.var(--graupl-input-border-left-style)
--graupl-fieldset-border-styleThe border style for fieldset components (combines top, right, bottom, and left styles).var(--graupl-fieldset-border-top-style) var(--graupl-fieldset-border-right-style) var(--graupl-fieldset-border-bottom-style) var(--graupl-fieldset-border-left-style)
--graupl-fieldset-border-top-left-radiusThe top-left border radius for fieldset components.var(--graupl-input-border-top-left-radius)
--graupl-fieldset-border-top-right-radiusThe top-right border radius for fieldset components.var(--graupl-input-border-top-right-radius)
--graupl-fieldset-border-bottom-right-radiusThe bottom-right border radius for fieldset components.var(--graupl-input-border-bottom-right-radius)
--graupl-fieldset-border-bottom-left-radiusThe bottom-left border radius for fieldset components.var(--graupl-input-border-bottom-left-radius)
--graupl-fieldset-border-radiusThe border radius for fieldset components (combines top-left, top-right, bottom-right, and bottom-left radii).var(--graupl-fieldset-border-top-left-radius) var(--graupl-fieldset-border-top-right-radius) var(--graupl-fieldset-border-bottom-right-radius) var(--graupl-fieldset-border-bottom-left-radius)
--graupl-input-border-colorThe border color for input components.var(--graupl-border-color)
--graupl-input-disabled-border-colorThe border color for disabled input components.var(--graupl-theme-active--secondary--200)
--graupl-fieldset-border-colorThe border color for fieldset components.var(--graupl-input-border-color)
--graupl-fieldset-disabled-border-colorThe border color for disabled fieldset components.var(--graupl-input-disabled-border-color)
--graupl-input-accent-colorThe accent color for input components.var(--graupl-input-color)

Sass variables ​

The following Sass variables can be used to customize the generation of the form components:

VariableDescriptionDefault Value
$selector-baseThe selector base for the component.""
$modifier-selector-baseThe selector base for component modifiers."."
$generate-base-theme-mapFlag to generate the base theme maps for form elements.true
$themeableFlag to generate theme modifiers.true
$input-selector-baseThe base selector for the input component.""
$input-selectorThe input component selector."input"
$input-theme-prefix-selector-baseSelector base used for input theme modifiers."."
$input-theme-prefix-selectorSelector prefix used for input theme modifiers.""
$textarea-selector-baseThe base selector for the textarea component.""
$textarea-selectorThe textarea component selector."textarea"
$select-selector-baseThe base selector for the select component.""
$select-selectorThe select component selector."select"
$label-selector-baseThe base selector for the label component.""
$label-selectorThe label component selector."label"
$label-theme-prefix-selector-baseSelector base used for label theme modifiers."."
$label-theme-prefix-selectorSelector prefix used for label theme modifiers.""
$fieldset-selector-baseThe base selector for the fieldset component.""
$fieldset-selectorThe fieldset component selector."fieldset"
$fieldset-theme-prefix-selector-baseSelector base used for fieldset theme modifiers."."
$fieldset-theme-prefix-selectorSelector prefix used for fieldset theme modifiers.""
$fieldset-directionThe direction of fieldset component items.column
$input-type-selectorsVarious tyles of inputs and their associated selectors.()
$input-theme-mappingsMap of properties and shade values applied to themed input variants.()
$input-theme-mapFully expanded property map used to generate themed input variants.()
$label-theme-mappingsMap of properties and shade values applied to themed label variants.()
$label-theme-mapFully expanded property map used to generate themed label variants.()
$fieldset-theme-mappingsMap of properties and shade values applied to themed fieldset variants.()
$fieldset-theme-mapFully expanded property map used to generate themed fieldset variants.()