Giter VIP home page Giter VIP logo

tailwind-elements's Introduction

Tailwind Elements

npm version build status downloads js-standard-style

DOM elements built with Tailwind CSS using bel. Work in progress.

Install

$ npm i tailwind-elements
// or
$ yarn add tailwind-elements

Elements

Use elements by importing them accordingly like require('tailwind-elements/$element').

header(title, subtitle)

Simple title with optional subtitle.

input(attributes)

Form input element.

Params

  • attributes.type: {String} Input type.
  • attributes.name: {String} Input name.
  • attributes.placeholder: {String} Input placeholder.
  • attributes.value: Input value.
  • attributes.onChange: {Function} Input value change listener.
  • attributes.required: {Boolean} Whether input is required or not.
  • attributes.className: {String} Additional css classes.

textarea(attributes)

Form textarea element.

Params

  • attributes.name: {String} Input name.
  • attributes.placeholder: {String} Input placeholder.
  • attributes.value: Input value.
  • attributes.onChange: {Function} Input value change listener.
  • attributes.className: {String} Additional css classes.

select(attributes)

Select element.

Params

  • attributes.name: {String} Input name.
  • attributes.value: Input value.
  • attributes.onChange: {Function} Input value change listener.
  • attributes.className: {String} Additional css classes.

inputContainer(label, input)

Form elements wrapping element.

Params

  • label: {String} Input label.
  • input: {HTMLElement} input element.

Example

var inputContainer = require('tailwind-elements/input-container')
var input = require('tailwind-elements/input')

inputContainer('First Name', input({
  name: 'first-name',
  required: true
}))

navbar(props)

Navigation bar. Please see navigation example

Params

  • props.brand: {String | HTMLElement} Branding text / element.
  • props.items: {Array} Array of navigation items.
    • item.label: {String} Nav label.
    • item.href: {String} Nav link.
  • props.loginItem: {String | HTMLElement} Login info text / element.

steps(items)

Progress steps element.

Params

  • items: {Array} Step items.
    • item.label: {String | HTMLElement} Step label.
    • item.href: {String} Step link.
    • item.onClick: {Function} Click handler for the step.
    • item.active: {Boolean} Whether the step is active or not.

Dropdown

Dropdown component. Based on nanocomponent.

Params

  • props.label: {String | HTMLElement} Dropdown label.
  • props.className: {String} Additional css classes.
  • props.items: [Array] Array of dropdown items.

dropdownMenuItem(props)

Dropdown menu item element.
Params

  • props.label: {String | HTMLElement} Menu item label.
  • props.onClick: {Function} Click handler for the menu item.
  • item.href: {String} Menu item link.

Example

var Dropdown = require('tailwind-elements/Dropdown')
var dropdownMenuItem = require('tailwind-elements/dropdown-menu-item')

new Dropdown({
  label: User,
  items: [
    dropdownMenuItem({ label: 'My Account', href: '/account/profile' }),
    dropdownMenuItem({ label: 'Logout', href: '/account/logout' })
  ]
})

License

MIT

Author

Ismail Demirbilek - @dbtek

tailwind-elements's People

Contributors

dbtek avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

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.