18 KiB
templateEngineOverride, layout, title, description, toc
| templateEngineOverride | layout | title | description | toc | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| njk | layouts/page.njk | Input Group | Add icons, text, buttons, and helper content to inputs and textareas. |
|
{% from "macros/code_block.njk" import code_block %} {% from "macros/code_preview.njk" import code_preview %} {% from "dropdown-menu.njk" import dropdown_menu %}
{% set spinner_icon %}{% lucide "loader-circle", { "role": "status", "aria-label": "Loading", "class": "animate-spin" } %}{% endset %}
{% set code_default %}
{% lucide "arrow-up" %}
{{ code_preview("input-group-default", code_default | prettyHtml, class="w-full max-w-sm") }}
Usage
{% set code_usage %}
{{ code_block(code_usage | prettyHtml, "html") }}
Use .input-group on the root. The group owns the visible shell. Native controls stay semantic and become borderless children inside that shell.
The component has the following HTML structure:
<div class="input-group">- The root shell. Add
role="group"and an accessible label only when the group itself needs to be named.<input>,<textarea>,<select>- The native control. Use
aria-invalid="true"for invalid state anddisabledfor disabled state. <span>,<svg>,<kbd>- Decorative or helper content. Use
aria-hidden="true"for decorative icons. <button>,<div role="group">- Interactive actions. Use
role="group"with an accessible label when multiple related actions share one side of the input. <header>,<footer>- Header or footer addon rows for vertically oriented input groups.
data-align="start|end"- Optional visual placement. Values use logical direction, so start/end automatically flip in RTL. Use
data-orientation="vertical"on the root for header/footer layouts. [data-control]- Escape hatch for custom controls that are not native
input,textarea, orselect.
Examples
Align
Use data-align="start|end" on addon wrappers to position them inline. Use data-orientation="vertical" with header or footer for block placement.
inline-start
{% set code_align_inline_start %}
Icon positioned at the start.
{{ code_preview("input-group-inline-start", code_align_inline_start | prettyHtml, class="w-full max-w-sm") }}
inline-end
{% set code_align_inline_end %}
Icon positioned at the end.
{{ code_preview("input-group-inline-end", code_align_inline_end | prettyHtml, class="w-full max-w-sm") }}
block-start
{% set code_align_block_start %}
Header positioned above the input.
Header positioned above the textarea.
{{ code_preview("input-group-block-start", code_align_block_start | prettyHtml, class="w-full max-w-sm") }}
block-end
{% set code_align_block_end %}
Footer positioned below the input.
Footer positioned below the textarea.
{{ code_preview("input-group-block-end", code_align_block_end | prettyHtml, class="w-full max-w-sm") }}
Icon
{% set code_icon %}
{{ code_preview("input-group-icon", code_icon | prettyHtml, class="w-full max-w-sm") }}
Text
{% set code_text %}
{{ code_preview("input-group-text", code_text | prettyHtml, class="w-full max-w-sm") }}
Button
{% set code_button %}
{{ code_preview("input-group-button", code_button | prettyHtml, class="w-full max-w-sm") }}
Kbd
{% set code_kbd %}
{{ code_preview("input-group-kbd", code_kbd | prettyHtml, class="w-full max-w-sm") }}
Dropdown
{% set code_dropdown %}
{{ code_preview("input-group-dropdown", code_dropdown | prettyHtml, class="w-full max-w-sm") }}
Spinner
{% set code_spinner %}
{{ code_preview("input-group-spinner", code_spinner | prettyHtml, class="w-full max-w-sm") }}
Textarea
{% set code_textarea %}
{{ code_preview("input-group-textarea", code_textarea | prettyHtml, class="w-full max-w-md") }}
Custom Input
{% set code_custom %}
{{ code_preview("input-group-custom", code_custom | prettyHtml, class="w-full max-w-sm") }}
RTL
{% set code_rtl %}
تذييل موضع أسفل منطقة النص.
{{ code_preview("input-group-rtl", code_rtl | prettyHtml, class="w-full max-w-sm") }}