xgqfrms™, xgqfrms® : xgqfrms's offical website of cnblogs! xgqfrms™, xgqfrms® : xgqfrms's offical website of GitHub!

Headless UI All In One

Headless UI All In One

Headless UI is an unstyled component library for either React.js or Vue.js from the same people that created Tailwind CSS.

image

https://www.wappalyzer.com/technologies/ui-frameworks/headless-ui

Headless UI

Unstyled, fully accessible UI components

image

https://headlessui.com/

17.4k stars
165 watching
686 forks

https://github.com/tailwindlabs/headlessui

demos

Switch (Toggle)

$ npm install @headlessui/react

https://headlessui.com/react/switch

image

import { useState } from 'react'
import { Switch } from '@headlessui/react'

export default function Example() {
  const [enabled, setEnabled] = useState(false)

  return (
    <div className="py-16">
      <Switch
        checked={enabled}
        onChange={setEnabled}
        className={`${enabled ? 'bg-teal-900' : 'bg-teal-700'}
          relative inline-flex h-[38px] w-[74px] shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none focus-visible:ring-2  focus-visible:ring-white focus-visible:ring-opacity-75`}
      >
        <span className="sr-only">Use setting</span>
        <span
          aria-hidden="true"
          className={`${enabled ? 'translate-x-9' : 'translate-x-0'}
            pointer-events-none inline-block h-[34px] w-[34px] transform rounded-full bg-white shadow-lg ring-0 transition duration-200 ease-in-out`}
        />
      </Switch>
    </div>
  )
}


refs

Tailwind CSS

A Utility-First CSS Framework for Rapidly Building Custom Designs

https://tailwindcss.com/

https://github.com/tailwindlabs/tailwindcss



©xgqfrms 2012-2025

www.cnblogs.com/xgqfrms 发布文章使用:只允许注册用户才可以访问!

原创文章,版权所有©️xgqfrms, 禁止转载 🈲️,侵权必究⚠️!


posted @   xgqfrms  阅读(235)  评论(1编辑  收藏  举报
相关博文:
阅读排行:
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· .NET10 - 预览版1新功能体验(一)
历史上的今天:
2020-11-03 Java IO 通信 All In One
2020-11-03 Free Video Player All In One
2020-11-03 Web 实时通信方案 All In One
2020-11-03 Self-XSS All In One
2020-11-03 Swift private(set) All In One
2020-11-03 Tumult Hype All In One
点击右上角即可分享
微信分享提示