1
0
mirror of https://github.com/tabler/tabler.git synced 2025-12-22 01:44:25 +04:00
Files
tabler/docs/content/ui/forms/form-elements.md
2025-05-12 18:48:48 +02:00

20 KiB

title, summary, bootstrapLink, docs-libs, description, order
title summary bootstrapLink docs-libs description order
Form elements Forms are one of the most important types of interaction with a website or app. Since their aim is to enable users to make a purchase, subscribe to a service or sign up to create an account, it's important to make sure they are easy to complete and help increase conversion rates. Use the available elements to create forms which are well-structured and user-friendly. components/forms/ nouislider Design user-friendly and effective forms. 1

Classic inputs

Use classic, user-friendly inputs, label them appropriately and include input placeholders that will help users avoid confusion when completing a form. Add the form-control class to style your input controls.

<input type="text" class="form-control" name="example-text-input" placeholder="Input placeholder" />

All variants of the input control are available in the examples below:

{% capture html -%}

Text
Password
Disabled
Readonly
{%- endcapture %} {% include "docs/example.html" html=html %}

Form control rounded

Use the form-control-rounded class if you prefer form controls with rounded corners.

{% capture html -%}

Form control rounded
{%- endcapture %} {% include "docs/example.html" html=html %}

Form control flush

You can remove borders from your form control by adding the form-control-flush class.

{% capture html -%} Form control flush {%- endcapture %} {% include "docs/example.html" html=html %}

Input with icon

Add icons to your input controls to suggest users what they should enter or inform them of the current state of a form element.

{% capture html -%}

Icon input
Loader input
{%- endcapture %} {% include "docs/example.html" html=html %}

Separated inputs

Include an additional element in your input section, such as a button which can be used to submit the information entered in the input control.

{% capture html -%}

Separated inputs
{%- endcapture %} {% include "docs/example.html" html=html %}

Textarea and select

Use a multi-line text input control to enable users to enter longer pieces of text. The control will automatically adjust to the length of the text entered.

Add one of the available selects - either a dropdown or a multiple choice select - to let users choose from a predefined set of options.

{% capture html -%}

Textarea
Select
One Two Three
Select multiple
One Two Three
{%- endcapture %} {% include "docs/example.html" html=html %}

Input size

Choose the size of an input control that will go well with your form design. Besides the default size, you can also use small and large input controls.

{% capture html -%}

Input sizing
{%- endcapture %} {% include "docs/example.html" html=html %}

Datalists

Use the datalist element to add an autocomplete feature to your input control. The list of available options will display once a user starts to type and will make it quicker to complete form sections.

{% capture html -%}

Datalist example
{%- endcapture %} {% include "docs/example.html" html=html %}

Toggle switches

Use toggle switches for the elements of your form which require choosing between two opposing states.

{% capture html -%}

Toggle switches
Option 1 Option 2 Option 3
Single switch
I agree with terms and conditions
{%- endcapture %} {% include "docs/example.html" html=html %}

Radios

Use radio buttons for the parts of your form which require users to choose one option from a set of two or more mutually exclusive options.

{% capture html -%}

Radios
Option 1 Option 2 Option 3 Option 4
{%- endcapture %} {% include "docs/example.html" html=html %}

{% capture html -%}

Inline Radios
Option 1 Option 2 Option 3
{%- endcapture %} {% include "docs/example.html" html=html %}

Checkboxes

Use checkboxes if you want to allow users to select more than one option from a set of predefined options or to turn an option on or off.

{% capture html -%}

Checkboxes
Checkbox input Disabled checkbox input Checked checkbox input
Inline Checkboxes
Option 1 Option 2 Option 3
{%- endcapture %} {% include "docs/example.html" html=html %}

Range input

Add a range slider to make it possible for users to set a value or range, such as a price range or a time frame.

{% capture html -%}

Range input
<script> document.addEventListener("DOMContentLoaded", function () { window.noUiSlider && noUiSlider.create(document.getElementById("range-color"), { start: 40, connect: [true, false], step: 10, range: { min: 0, max: 100, }, }); }); </script> {%- endcapture %} {% include "docs/example.html" html=html %}

Input group

Create a group of input controls and place add-ons on either side of an input.

{% capture html -%}

Input group
@
.tabler.io
https:// .tabler.io
{%- endcapture %} {% include "docs/example.html" html=html %}

Input with checkboxes or radios

Add checkboxes or radio buttons on either side of your input control.

{% capture html -%}

Input with checkbox or radios
{%- endcapture %} {% include "docs/example.html" html=html %}

Input with prepended or appended text

Add text to your input control, either before or after the text which is to be entered by a user.

{% capture html -%}

Input with prepended text
.tabler.io
{%- endcapture %} {% include "docs/example.html" html=html %}

Include a link in your input control to add a clickable element within the control.

{% capture html -%}

Input with appended link
{%- endcapture %} {% include "docs/example.html" html=html %}

Input with appended kbd

Include a <kbd> in your input control to add a shortcut hint to the control.

{% capture html -%}

Input with appended kbd
ctrl + K
{%- endcapture %} {% include "docs/example.html" html=html %}

Add an icon link which you want to display at the end of your input control to visually represent actions which a user can take.

{% capture html -%}

Input with appended icon links
{%- endcapture %} {% include "docs/example.html" html=html %}