Here are some examples showcasing label components.

Basic Labels

Labels are used to provide text descriptions for form inputs. They can be used with any form input component.

Preview
Code
.my-2.flex.flex-col.gap-4
  = daisy_label(for: "input1", title: "Standard Label")

  = daisy_label(for: "input2") do
    Content Block Label

With Form Inputs

Labels can be used with form inputs to provide a description for the input. Here's an example with a checkbox.

Preview
Code
.my-2.flex.flex-col.gap-4
  .flex.items-center.space-x-2
    = daisy_checkbox(name: "accept", id: "accept")
    = daisy_label(for: "accept", title: "I accept the terms and conditions")

Form Builder Example

Labels can also be used with the form builder to create form inputs with labels that are automatically associated with the inputs.

Preview
Code
= form_with(url: "#", method: :post) do |form|
  .flex.items-center.space-x-2
    = form.daisy_checkbox("newsletter")
    = form.daisy_label("newsletter", "Subscribe to our newsletter")
Made with by Profoundry .
Copyright © 2023-2025 Profoundry LLC.
All rights reserved.