Skip to content

<Label> has no way of providing the input value #568

@schnittchen

Description

@schnittchen

Describe the bug

The Label component internally uses input_id/2, never input_id/3. The generated for attribute is never correct for a radio button or checkbox.

As a workaround, I am currently doing

<Label opts={for: nil}>
  <RadioButton value="value" />
  label text
</Label>

How to reproduce it

Clicking on the label text with this markup

<Label>
  <RadioButton value="value" />
  label text
</Label>

There are probably also legitimate use cases where wrapping the around the input is not feasible, so it would be good to allow <Label value={...}>text</Label> or similar.

does not select the nested radio button.

Your Environment

Surface: v0.7.0
LiveView: v0.17.6
Elixir: v1.13.0 (compiled with Erlang/OTP 24)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions