Minimalist Form Styles
atoms/forms.css
This file contains CSS classes for styling form elements, focusing on consistent spacing, borders, and user interaction states.
General Elements
fieldset
- Description: Sets a default block start and end margin for all
fieldset
elements.
Inputs, Selects, and Textareas
input
, select:not(.custom-select)
, textarea
- Description: Sets the default border and padding for basic form elements.
- Use Case: Ensures a consistent look and feel for form controls.
input:user-valid
, textarea:user-valid
- Description: Applies styles for valid input states.
- Use Case: Provides visual feedback for valid user input.
input:user-invalid
, textarea:user-invalid
- Description: Applies styles for invalid input states.
- Use Case: Indicates incorrect or incomplete user input.
Interaction States
Focus and Validation Styling
- Combined Valid and Invalid States:
- Targets focus and validation states with
outline-offset: var(--size-2);
- Applies to:
input:user-valid
input:user-invalid
input:focus:invalid:not(:user-invalid)
textarea:user-valid
textarea:user-invalid
textarea:focus:invalid:not(:user-invalid)
- Targets focus and validation states with
input:focus:invalid:not(:user-invalid)
, textarea:focus:invalid:not(:user-invalid)
- Description: Ensures fields are not styles as invalid before having received user input.
CSS Custom Properties and Defaults
Custom Property | Default Value |
---|---|
--minimalist-fieldset-margin-block | 0.75rem |
--minimalist-form-field-gap | 0.75rem |
--minimalist-form-field-margin-block-end | 0.75rem |
--minimalist-input-border | 0.125rem solid #4e4e4e |
--minimalist-input-padding | 0.375rem |
--minimalist-input-border-valid-color | #007d50 |
--minimalist-input-border-valid-outline | #00bc7a |
--minimalist-input-border-critical-color | #db000e |
--minimalist-input-border-critical-outline | #ff7d7e |
--minimalist-input-border-warning-color | #978c00 |
--minimalist-input-border-warning-outline | #b4a700 |