Files
thrillwiki_django_no_react/templates/cotton/input.html
2025-09-21 20:19:12 -04:00

47 lines
1.7 KiB
HTML

{% comment %}
Input Component - Django Cotton Version of shadcn/ui Input
Usage: <c-input type="text" placeholder="Enter text..." name="field_name" />
Preserves EXACT same HTML output as the original include version
{% endcomment %}
<c-vars
type="text"
name=""
id=""
placeholder=""
value=""
required=""
disabled=""
readonly=""
autocomplete=""
x_model=""
x_on=""
hx_get=""
hx_post=""
hx_target=""
hx_trigger=""
hx_swap=""
hx_include=""
/>
<input
type="{{ type|default:'text' }}"
class="flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 {{ class|default:'' }}"
{% if name %}name="{{ name }}"{% endif %}
{% if id %}id="{{ id }}"{% endif %}
{% if placeholder %}placeholder="{{ placeholder }}"{% endif %}
{% if value %}value="{{ value }}"{% endif %}
{% if required %}required{% endif %}
{% if disabled %}disabled{% endif %}
{% if readonly %}readonly{% endif %}
{% if autocomplete %}autocomplete="{{ autocomplete }}"{% endif %}
{% if x_model %}x-model="{{ x_model }}"{% endif %}
{% if x_on %}{{ x_on }}{% endif %}
{% if hx_get %}hx-get="{{ hx_get }}"{% endif %}
{% if hx_post %}hx-post="{{ hx_post }}"{% endif %}
{% if hx_target %}hx-target="{{ hx_target }}"{% endif %}
{% if hx_trigger %}hx-trigger="{{ hx_trigger }}"{% endif %}
{% if hx_swap %}hx-swap="{{ hx_swap }}"{% endif %}
{% if hx_include %}hx-include="{{ hx_include }}"{% endif %}
{{ attrs }}
/>