forms
Tailwind CSS
Select A select element is utilized to choose a value from a range of options.
Basic select example.
Copy
toggleRTL($refs.previewFrame), 100);
}" class="size-9.5 border-neutral/10 rounded-btn text-base-content hover:bg-neutral/[0.03] flex items-center justify-center gap-2 border max-sm:hidden">
Pick your favorite Movie The Godfather The Shawshank Redemption Pulp Fiction The Dark Knight Schindler's List
The <select>
element’s customization options are primarily confined to its initial appearance. Due to browser constraints, modifications to the appearance of <option>
elements within the dropdown are not possible.
Copy
toggleRTL($refs.previewFrame), 100);
}" class="size-9.5 border-neutral/10 rounded-btn text-base-content hover:bg-neutral/[0.03] flex items-center justify-center gap-2 border max-sm:hidden">
Pick your favorite Movie
The Godfather The Shawshank Redemption Pulp Fiction The Dark Knight Schindler's List
The label
remains in its floated position at all times, unlike with input
elements. Pair select-floating
with your select
element and select-floating-label
for the label.
Copy
toggleRTL($refs.previewFrame), 100);
}" class="size-9.5 border-neutral/10 rounded-btn text-base-content hover:bg-neutral/[0.03] flex items-center justify-center gap-2 border max-sm:hidden">
The Godfather The Shawshank Redemption Pulp Fiction The Dark Knight Schindler's List
Pick your favorite Movie
Apply the select-filled
class to give your select element a background, and use select-filled-label
for the label that will float above the text.
Copy
toggleRTL($refs.previewFrame), 100);
}" class="size-9.5 border-neutral/10 rounded-btn text-base-content hover:bg-neutral/[0.03] flex items-center justify-center gap-2 border max-sm:hidden">
The Godfather The Shawshank Redemption Pulp Fiction The Dark Knight Schindler's List
Pick your favorite Movie
Default select has 4 size default, small and large.
Copy
toggleRTL($refs.previewFrame), 100);
}" class="size-9.5 border-neutral/10 rounded-btn text-base-content hover:bg-neutral/[0.03] flex items-center justify-center gap-2 border max-sm:hidden">
Pick your favorite Movie The Godfather The Shawshank Redemption Pulp Fiction The Dark Knight Schindler's List
Pick your favorite Movie The Godfather The Shawshank Redemption Pulp Fiction The Dark Knight Schindler's List
Pick your favorite Movie The Godfather The Shawshank Redemption Pulp Fiction The Dark Knight Schindler's List
Pick your favorite Movie The Godfather The Shawshank Redemption Pulp Fiction The Dark Knight Schindler's List
Floating select has 3 sizes example.
Copy
toggleRTL($refs.previewFrame), 100);
}" class="size-9.5 border-neutral/10 rounded-btn text-base-content hover:bg-neutral/[0.03] flex items-center justify-center gap-2 border max-sm:hidden">
The Godfather The Shawshank Redemption Pulp Fiction The Dark Knight Schindler's List
Pick your favorite Movie
The Godfather The Shawshank Redemption Pulp Fiction The Dark Knight Schindler's List
Pick your favorite Movie
The Godfather The Shawshank Redemption Pulp Fiction The Dark Knight Schindler's List
Pick your favorite Movie
Filled select has 3 sizes example.
Copy
toggleRTL($refs.previewFrame), 100);
}" class="size-9.5 border-neutral/10 rounded-btn text-base-content hover:bg-neutral/[0.03] flex items-center justify-center gap-2 border max-sm:hidden">
The Godfather The Shawshank Redemption Pulp Fiction The Dark Knight Schindler's List
Pick your favorite Movie
The Godfather The Shawshank Redemption Pulp Fiction The Dark Knight Schindler's List
Pick your favorite Movie
The Godfather The Shawshank Redemption Pulp Fiction The Dark Knight Schindler's List
Pick your favorite Movie
Success state which can be added by using class is-valid
.
Copy
toggleRTL($refs.previewFrame), 100);
}" class="size-9.5 border-neutral/10 rounded-btn text-base-content hover:bg-neutral/[0.03] flex items-center justify-center gap-2 border max-sm:hidden">
Full Name
Top Right label
The Godfather The Shawshank Redemption Pulp Fiction The Dark Knight Schindler's List Bottom Left label
Bottom Right label
Top Right label
The Godfather The Shawshank Redemption Pulp Fiction The Dark Knight Schindler's List
Pick your favorite Movie
Bottom Left label
Bottom Right label
Top Right label
The Godfather The Shawshank Redemption Pulp Fiction The Dark Knight Schindler's List
Pick your favorite Movie
Bottom Left label
Bottom Right label
Error state can be added using class is-invalid
.
Copy
toggleRTL($refs.previewFrame), 100);
}" class="size-9.5 border-neutral/10 rounded-btn text-base-content hover:bg-neutral/[0.03] flex items-center justify-center gap-2 border max-sm:hidden">
Full Name
Top Right label
The Godfather The Shawshank Redemption Pulp Fiction The Dark Knight Schindler's List Bottom Left label
Bottom Right label
Top Right label
The Godfather The Shawshank Redemption Pulp Fiction The Dark Knight Schindler's List
Pick your favorite Movie
Bottom Left label
Bottom Right label
Top Right label
The Godfather The Shawshank Redemption Pulp Fiction The Dark Knight Schindler's List
Pick your favorite Movie
Bottom Left label
Bottom Right label
Use the rounded-full
utility class to make select’s circular. The default shape of the select but can be altered by using TailwindCSS Border Radius .
Copy
toggleRTL($refs.previewFrame), 100);
}" class="size-9.5 border-neutral/10 rounded-btn text-base-content hover:bg-neutral/[0.03] flex items-center justify-center gap-2 border max-sm:hidden">
Pick your favorite Movie The Godfather The Shawshank Redemption Pulp Fiction The Dark Knight Schindler's List The Godfather The Shawshank Redemption Pulp Fiction The Dark Knight Schindler's List
Pick your favorite Movie
The Godfather The Shawshank Redemption Pulp Fiction The Dark Knight Schindler's List
Pick your favorite Movie
The form-control
acts as a wrapper for the label and the select elements. Inside this wrapper, the label
class is styled in two ways: label-text
is used for the select’s label, and label-text-alt
is for the additional helper text.
Copy
toggleRTL($refs.previewFrame), 100);
}" class="size-9.5 border-neutral/10 rounded-btn text-base-content hover:bg-neutral/[0.03] flex items-center justify-center gap-2 border max-sm:hidden">
Pick your favorite Movie
Sub label
The Godfather The Shawshank Redemption Pulp Fiction The Dark Knight Schindler's List Sub label
Sub label
label
elements hidden using the .sr-only
class.
Copy
toggleRTL($refs.previewFrame), 100);
}" class="size-9.5 border-neutral/10 rounded-btn text-base-content hover:bg-neutral/[0.03] flex items-center justify-center gap-2 border max-sm:hidden">
Pick your favorite Movie
The Godfather The Shawshank Redemption Pulp Fiction The Dark Knight Schindler's List Disable a select
element by adding the disabled
attribute, making it non-selectable.
Copy
toggleRTL($refs.previewFrame), 100);
}" class="size-9.5 border-neutral/10 rounded-btn text-base-content hover:bg-neutral/[0.03] flex items-center justify-center gap-2 border max-sm:hidden">
Pick your favorite Movie The Godfather The Shawshank Redemption Pulp Fiction The Dark Knight Schindler's List The Godfather The Shawshank Redemption Pulp Fiction The Dark Knight Schindler's List
Pick your favorite Movie
The Godfather The Shawshank Redemption Pulp Fiction The Dark Knight Schindler's List
Pick your favorite Movie
Associate a datalist
element with an input
to provide a list of suggested options, allowing users to select from predefined choices or enter a custom value.
Copy
toggleRTL($refs.previewFrame), 100);
}" class="size-9.5 border-neutral/10 rounded-btn text-base-content hover:bg-neutral/[0.03] flex items-center justify-center gap-2 border max-sm:hidden">
Enable the selection of multiple options in a select
element by adding the multiple
attribute.
Copy
toggleRTL($refs.previewFrame), 100);
}" class="size-9.5 border-neutral/10 rounded-btn text-base-content hover:bg-neutral/[0.03] flex items-center justify-center gap-2 border max-sm:hidden">
Pick your favorite Movies:
The Godfather The Shawshank Redemption Pulp Fiction The Dark Knight Schindler's List
Utilize the optgroup
element to group option
elements together within a select
dropdown, creating organized sections.
Copy
toggleRTL($refs.previewFrame), 100);
}" class="size-9.5 border-neutral/10 rounded-btn text-base-content hover:bg-neutral/[0.03] flex items-center justify-center gap-2 border max-sm:hidden">
Choose a technology:
HTML CSS JavaScript Node.js Python Java