Giter VIP home page Giter VIP logo

unlight / tailwind-float-label Goto Github PK

View Code? Open in Web Editor NEW
2.0 3.0 0.0 1.06 MB

Tailwind plugin to add floating label, control with float label components

Home Page: https://unlight.github.io/tailwind-float-label

License: MIT License

JavaScript 30.20% Shell 4.27% HTML 40.14% TypeScript 25.01% CSS 0.38%
floating-label float-label float-label-pattern tailwindcss-plugin tailwind-plugin tailwind-plugins tailwind-component tailwind-components

tailwind-float-label's Introduction

tailwind-float-label

Tailwind plugin to add floating label, control with float label components

Demo - https://unlight.github.io/tailwind-float-label

Setup

npm install --save-dev tailwind-float-label

Add plugin to plugins section of tailwind.config.js

plugins: [require('tailwind-float-label')(options)],

Options

type Options = {
    /**
     * Custom styles for container.
     */
    container?: DeepPartial<{ [k: string]: string } | string>;
    /**
     * Custom styles for input control.
     */
    control?: DeepPartial<{ [k: string]: string } | string>;
    /**
     * Custom styles for label.
     */
    label?: DeepPartial<{ [k: string]: string } | string>;
};

Usage

Plugins adds these components supposed used together:

  • .float-label-container Container which holds input control and label
  • .float-label-control Form control
  • .float-label-self Label
  • .float-label-sticky Label which is always visible
  • But .float-label-auto Automatically make label floating and input inside this container
<form class="max-w-xs mx-auto p-5 space-y-4">
    <h2 class="text-2xl font-bold text-center">Example</h2>
    <div class="float-label-container">
        <input
            type="text"
            id="name"
            autocomplete="off"
            placeholder="Name"
            class="float-label-control outline-none focus:shadow-outline border w-full px-1"
        />
        <label for="name" class="float-label-self bg-white text-gray-500">Name</label>
    </div>
    <!-- Auto: make `label` floating for `input` -->
    <div class="float-label-auto">
        <input
            type="text"
            id="auto"
            autocomplete="off"
            placeholder="Auto"
            class="outline-none focus:shadow-outline border w-full px-1"
        />
        <label for="auto" class="bg-white text-gray-500">Auto</label>
    </div>
</form>

Notes:

.float-label-control and .float-label-self must be direct children of .float-label-container

Similar Projects

Resources

tailwind-float-label's People

Contributors

semantic-release-bot avatar unlight avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

tailwind-float-label's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.