Skip to content

docs(FormField): document and exemplify the #label slot #48

Description

@IgorShevchik

Summary

B24FormField already exposes a #label slot, but it is undocumented and has no usage example. Developers reading the docs only see the label prop (a plain string) and have no signal that a richer, custom label is possible without overriding internals.

Current state (the slot exists)

src/runtime/components/FormField.vue declares and renders the slot:

// FormField.vue (slots interface)
export interface FormFieldSlots {
  label?(props: { label: string | undefined }): VNode[]
  // ...
}
<!-- FormField.vue (template) -->
<Label :for="id" data-slot="label" :class="b24ui.label({ class: props.b24ui?.label })">
  <slot name="label" :label="props.label">
    {{ props.label }}
  </slot>
</Label>

So the capability is shipped and working — this is not a feature request to add the slot.

The gap

docs/content/docs/2.components/form-field.md documents only the label prop (the "Label" section). There is:

  • no mention of the #label slot,
  • no example showing a rich label (e.g. label text + a trailing help/info icon or tooltip, a badge, or an inline link).

This is the real-world need behind "rich labels" that comes up in record-edit / CRM forms (e.g. a field label with a help tooltip next to it).

Proposed changes

  • Add a "Label slot" subsection to form-field.md with a ::component-code example, e.g. a label composed of text + a small help icon/tooltip via the #label slot.
  • Note in the forms skill guideline that #label is available for custom labels (one line + snippet).
  • Optionally cross-link from the label prop section to the slot section.

Out of scope / for discussion

A separate, distinct gap (not this issue): there is no built-in "titled, bordered field-group / fieldset" primitive for grouping several FormFields under one labeled box (the "Client" sub-section pattern). If we want that, it should be its own issue/PR for a B24FieldGroup-style fieldset variant — please confirm interest before scoping.

Context: surfaced while reviewing the record-edit form example (branch claude/bitrix24-ui-layout-U2iTb).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions