GithubHelp home page GithubHelp logo

ambiguous48 / svelte-headlessui Goto Github PK

View Code? Open in Web Editor NEW

This project forked from captaincodeman/svelte-headlessui

1.0 1.0 0.0 3.46 MB

HeadlessUI components for Svelte

Home Page: https://captaincodeman.github.io/svelte-headlessui/

License: MIT License

JavaScript 2.99% TypeScript 39.27% CSS 7.59% HTML 0.16% Svelte 36.20% Astro 13.78%

svelte-headlessui's Introduction

minified minified + zipped

Svelte Headless-UI

Ultra-small (<3kb gzipped), unofficial, HeadlessUI inspired components for Svelte.

What is this?

A set of Svelte store and [use:action directives])(https://svelte.dev/docs#template-syntax-element-directives-use-action) factories that make it easier to create rich, WIA-ARIA accessible components. If you want to port TailwindUI components or other HTML sources to Svelte with the minimal added JS payload then this may be for you.

Rather than using slotted components, you are responsible for providing all the DOM and styling, responding to the changing store state as you want, and the use:action directives provide the way for the behavior and WIA-ARIA attribute handling to hook into your elements.

I believe this approach results in a smaller, simpler library. The library consists of common "behaviors" re-used by many components which account for under 6kb (uncompressed) with each component then around 1-2kb. Even including all components in your app will only add around 3kb of gzipped JavaScript.

Docs

Complete docs and examples are coming soon. In the meantime, checkout the dev-mode pages to see how they can be used (/packages/lib/src/routes)

Components

I hope to implement all the HeadlessUI components, and whatever other ARIA Patterns I find useful.

  • Toggle (Button)
  • Menu (DropDown)
  • Listbox (Select)
  • Combobox (Autocomplete)
  • Switch (Toggle)
  • Disclosure
  • Dialog (Modal)
  • Popover
  • Radio Group
  • Tabs
  • Transition: see separate svelte-transition package

Alternatives

There is an existing project, @rgossiaux/svelte-headlessui, that provides "a complete, full-featured, unofficial Svelte port of Headless UI, an unstyled, fully accessible UI component library" which aligns more closely with the Offical Tailwind HeadlessUI React and Vue packages in it's approach.

Rather than allowing a legacy web framework to dictate the architecture, I wanted to try a "Svelte-first" approach that took advantage of features that Svelte provides.

svelte-headlessui's People

Contributors

captaincodeman avatar thenbe avatar

Watchers

 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.