Input
LIVE PREVIEW 3
USAGE
{%{% endverbatim %} load theme_components {% verbatim %}%}
{%{% endverbatim %} theme_{{ name }}{% for p in required_context %} {{ p.name }}{% endfor %}{% for p in optional_context %} {{ p.name }}={{ p.default|default:"..." }}{% endfor %} {% verbatim %}%}
PROPS — REQUIRED 1
| Name | Type | Default |
|---|---|---|
name |
str |
— |
PROPS — OPTIONAL 9
| Name | Type | Default |
|---|---|---|
label |
Optional[str] |
— |
placeholder |
str |
— |
type |
str |
text |
css_prefix |
str |
— |
attrs |
dict |
— |
slot_label |
str |
— |
slot_input |
str |
— |
slot_help_text |
str |
— |
slot_error |
str |
— |
ACCESSIBILITY 1
| Requirement | Element | Attribute | Value |
|---|---|---|---|
| Label must reference input via for attribute | label |
for |
(present) |
AVAILABLE SLOTS 4
slot_label
slot_input
slot_help_text
slot_error
CSS VARIABLES 6
--background
--foreground
--input
--muted-foreground
--radius
--ring
TEMPLATE SOURCE
<div class="{{ css_prefix }}input-group {% if attrs.class %}{{ attrs.class }}{% endif %}">
{% if slot_label %}
{{ slot_label|safe }}
{% elif label %}
<label for="{{ name }}" class="{{ css_prefix }}input-label">{{ label }}</label>
{% endif %}
{% if slot_input %}
{{ slot_input|safe }}
{% else %}
<input
type="{{ type }}"
name="{{ name }}"
id="{{ name }}"
placeholder="{{ placeholder }}"
class="{{ css_prefix }}input"
{% if attrs.value %}value="{{ attrs.value }}"{% endif %}
{% if attrs.required %}required{% endif %}
{% if attrs.disabled %}disabled{% endif %}
{% if attrs.readonly %}readonly{% endif %}
/>
{% endif %}
{% if slot_help_text %}
<div class="{{ css_prefix }}input-help">{{ slot_help_text|safe }}</div>
{% endif %}
{% if slot_error %}
<div class="{{ css_prefix }}input-error" role="alert">{{ slot_error|safe }}</div>
{% endif %}
</div>