Skip to content

Commit a6b3d19

Browse files
committed
docs: Update README
1 parent 37d7c1e commit a6b3d19

File tree

2 files changed

+21
-32
lines changed

2 files changed

+21
-32
lines changed

README.md

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,24 @@ Demo - https://unlight.github.io/tailwind-float-label
88

99
1. `npm install --save-dev tailwind-float-label`
1010
2. Add `@import 'tailwind-float-label'` to your main css file
11-
3. Plugin provides classes which must be set for label and input to make label floats.
11+
3. Configure css variable `--float-label-background-color` for background of
12+
float label
13+
4. Plugin provides classes which must be set for label and input to make label floats.
1214
- `.float-container` Container which holds input control and label
1315
- `.float-input` Form input control
1416
- `.float-always` Use with `.float-container` to make label always visible (sticky)
1517

1618
```html
1719
<form class="max-w-xs mx-auto p-5 space-y-4">
18-
<h2 class="text-2xl font-bold text-center">Example</h2>
1920
<div class="float-container">
20-
<label for="name" class="float-label px-2 bg-white text-gray-500"
21-
>Name</label
21+
<label for="fullname" class="float-label px-2 text-gray-600"
22+
>Full Name</label
2223
>
2324
<input
2425
type="text"
25-
id="name"
26-
autocomplete="off"
27-
placeholder="Name"
28-
class="float-input outline-none focus:shadow-outline border w-full px-1"
26+
id="fullname"
27+
class="float-input w-full px-3 py-2 border border-gray-300"
28+
placeholder="Full Name"
2929
/>
3030
</div>
3131
</form>
@@ -47,11 +47,3 @@ If you need animation, add to `.float-label` following classes: `transition-all
4747
## License
4848

4949
[MIT License](https://opensource.org/licenses/MIT) (c) 2025
50-
51-
## TODO
52-
53-
- find information about plugins how to do it
54-
- how to set variables
55-
- update readme (no sticky, just remove input placeholder)
56-
- block with multiple type of input (select, text area)
57-
- block with size of inputs (lg, xs, sm)

index.html

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ <h1 class="text-xl font-bold mb-4 text-gray-800">Float Labels Example</h1>
1414
<form class="space-y-4">
1515
<div class="float-container">
1616
<label for="fullname" class="float-label px-2 text-gray-600"
17-
>Full Name (1: empty)</label
17+
>Full Name</label
1818
>
1919
<input
2020
type="text"
@@ -73,28 +73,25 @@ <h1 class="text-xl font-bold mb-4 text-gray-800">Float Labels Example</h1>
7373
></textarea>
7474
</div>
7575

76+
<div class="float-container text-3xl">
77+
<label for="bigname" class="float-label px-2 text-gray-600"
78+
>Big Name</label
79+
>
80+
<input
81+
type="text"
82+
id="bigname"
83+
class="float-input w-full px-3 py-2 border border-gray-300"
84+
placeholder="Full Name placeholder"
85+
/>
86+
</div>
87+
7688
<button
7789
type="button"
7890
class="w-full bg-blue-500 text-white py-2 px-4 hover:cursor-pointer"
7991
>
8092
Submit
8193
</button>
8294
</form>
83-
<form class="max-w-xs mx-auto p-5 space-y-4">
84-
<h2 class="text-2xl font-bold text-center">README Example</h2>
85-
<div class="float-container">
86-
<label for="name" class="float-label px-1 bg-white text-gray-500"
87-
>Name</label
88-
>
89-
<input
90-
type="text"
91-
id="name"
92-
autocomplete="off"
93-
placeholder="Name"
94-
class="float-input outline-none focus:shadow-outline border w-full px-1"
95-
/>
96-
</div>
97-
</form>
9895
</div>
9996
</body>
10097
</html>

0 commit comments

Comments
 (0)