Drupal Radix Theme
  • Introduction
    • Overview & Support
  • Installation
    • Requirements
    • Getting Started
    • Setup with ddev
  • Understanding Radix
    • Individual files and directories
    • Bootstrap Build
    • Bootswatch
  • Working with the components
    • Components: Intro
    • Components: A deep dive
    • An example component
    • The drupal-radix-cli
    • Copy and modify a component
  • Components
    • Accordion
    • Alerts
    • Badge
    • Block
    • Buttons
    • Button Group
    • Breadcrumb
    • Card
    • Carousel
    • Close button
    • Comment
    • Collapse
    • Details
    • Dropdown menu
    • Field
    • Field Comment
    • Fieldset
    • Figure
    • Form
    • Form: Element
    • Form Element Label
    • Form Element: Radio Checkbox
    • Heading
    • HTML
    • Image
    • Input
    • List group
    • Local Tasks
    • Media
    • Modal
    • Nav
    • Nav Item
    • Navbar
    • Navbar Brand
    • Node
    • Offcanvas
    • Page
    • Page: Content
    • Page: Footer
    • Page: Navigation
    • Page: Title
    • Pagination
    • Progress
    • Radios
    • Region
    • Select
    • Spinners
    • Table
    • Taxonomy
    • Textarea
    • Toasts
    • Tooltips
    • User
    • Views: view
    • Views: view--grid
    • Views: view--table
    • Views: view--unformatted
  • Misc
    • Migration and upgrading
    • Roadmap
    • Credits & Contributions
Powered by GitBook
On this page
  • Key Features
  • Template Structure
  • Customization
  • Usage

Was this helpful?

  1. Components

Form Element Label

A form element label is a component used to display a label for a form element. It is typically used in conjunction with form elements such as text fields, text areas, inputs and others.

Key Features

  • Supports various form elements.

  • Customizable label text.

  • Handles required field indicators.

  • Compatible with Radix 6 and Bootstrap 5.3.

Template Structure

The template structure for the form element label is defined in the form-element--label.twig file. It includes the following key elements:

  • title: The label's text.

  • title_display: Elements title_display setting.

  • required: An indicator for whether the associated form element is required.

  • attributes: A list of HTML attributes for the label.

Customization

You can customize the form element label by modifying the Twig template or by overriding the default classes and attributes. The following properties are available for customization:

  • title: Set the label text.

  • title_display: Control the display of the label (e.g., 'after', 'invisible').

  • required: Indicate if the form element is required.

  • attributes: Add custom HTML attributes to the label.

Usage

To include the form element label in your template, use the following Twig code:

{% include "radix:form-element--label" with {
  required: true,
  title: "Label",
  title_display: "after",
  attributes: {
    class: "form-label",
  }
} %}
PreviousForm: ElementNextForm Element: Radio Checkbox

Last updated 8 months ago

Was this helpful?