Skip to content

[KTextbox]: Allow label to be passed via slot #1166

@MisRob

Description

@MisRob

This issue is not open for contribution. Visit Contributing guidelines to learn about the contributing process and how to find suitable issues.

Current behavior

The only way to pass a label is via the label prop.

Desired behavior

  • Label can be passed either via label prop or label slot
  • There is validation that throws a warning in case a label is not passed via one of them
  • There is a documentation on how to use and not use the label slot

Value add

  • Supports use-cases when displaying a label visually is not desired (e.g. token readonly input in Studio's channel collections table)
<KTextbox>
  <template #label>
    <span class="visuallyhidden">Label</span> 
  </template>
</KTextbox>
  • Will allow to get rid of implementations when visual requirements led to label being bypassed by label=" ", such as here and other places, resulting in poor a11y due to missing labels.

  • Allows for any future customization of labels, should the need arise

Possible tradeoffs

General tradeoffs related to allowing anything be passed. Documentation will have guidance though.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions