Giter Site home page Giter Site logo

selemondev / windi-ui Goto Github PK

View Code? Open in Web Editor NEW
34.0 3.0 3.0 1.31 MB

Build Accessible Apps 10x faster with Windi UI ⚡ ( WIP :construction: )

Home Page: https://ui-windi.netlify.app/

License: MIT License

HTML 0.96% TypeScript 55.74% Vue 40.90% JavaScript 2.16% CSS 0.23%
tailwindcss-ui typescript typescript-library vue vue-component-library vue-components vue-ui vue-ui-components vue3-component-library vue3-components

windi-ui's Introduction

Windi UI 🚧

Build Accessible Apps 10x faster.

Features

  • 🦾 TypeScript Support - Built with TypeScript in mind and from the ground up.
  • 🔥 Icon - Use any icon from Iconify in your project from your favourite icon set.
  • 🛠️ On Demand Import - Windi UI comes with an intelligent resolver that automatically imports only used components.
  • 📦 Diverse Component Selection - Create your application effortlessly with our expansive collection of 50+ UI components.
  • ⚡️ Powerful Tools - Windi UI is built on top of powerful tools such as TailwindCss, VueUse, Headless UI etc.
  • 🎨 Themeable - Customize any part of our beautiful components to match your style.

Getting Started

Add Windi UI to your project by running one of the following commands below:

# pnpm
pnpm add windi-vue

# yarn
yarn add windi-vue

# npm
npm install windi-vue

Usage

  1. Add the Windi UI theme file and the darkMode class in your tailwind.config.cjs file as shown below:
/** @type {import('tailwindcss').Config} */
module.exports = {
  content: ['./index.html', './src/**/*.{vue,js,ts,jsx,tsx}', 'node_modules/windi-vue/dist/theme/*.{js,jsx,ts,tsx,vue}'],
  darkMode: 'class',
  theme: {
    extend: {},
  },
  plugins: [],
}

Component registration

With Windi UI, you have the flexibility to register components precisely as you wish:

Import All Components

To import all the components provided by Windi UI, add WindiUI in your main entry file as shown below:

import { createApp } from 'vue'
import windiTheme from 'windi-vue/dist/theme/windiTheme'
import WindiUI from 'windi-vue'
import App from './App.vue'

const app = createApp(App)
app.use(WindiUI, windiTheme)
app.mount('#app')

By doing this, you are importing all the components that are provided by Windi UI and in your final bundle all the components including the ones you didn't use will be bundled. Use this method of component registration if you are confident that you will use all the components.

Individual Components with Tree Shaking

Probably you might not want to globally register all the components but instead only import the components that you need. You can achieve this by doing the following:

  1. Import the createWindiUI option as well as the components you need as shown below:
import { createApp } from 'vue'
import './style.css'
import windiTheme from 'windi-vue/dist/theme/windiTheme'

import { WKbd, createWindiUI } from 'windi-vue'

import App from './App.vue'

const app = createApp(App)

const UI = createWindiUI({
  prefix: 'T',
  components: [WKbd],
})

app.use(UI, windiTheme)

app.mount('#app')
  1. Now you can use the component as shown below:
<template>
  <div>
    <TKbd>K</TKbd>
  </div>
</template>

The prefix option is only available for individual component imports.

Auto Imports with Tree Shaking

Windi UI comes with an intelligent resolver that automatically imports only used components.

This is made possible by leveraging a tool known as unplugin-vue-components which lets you auto import components on demand thus omitting import statements and still get the benefits of tree shaking.

To achieve this you need to do the following:

  1. Install the unplugin-vue-components package by running one of the following commands:
#pnpm
pnpm add -D unplugin-vue-components

#yarn
yarn add -D unplugin-vue-components

#npm
npm i -D unplugin-vue-components
  1. Head over to your main.ts or main.js file and set registerComponents to false as shown below:
import { createApp } from 'vue'
import './style.css'
import windiTheme from 'windi-vue/dist/theme/windiTheme'

import { createWindiUI } from 'windi-vue'

import App from './App.vue'

const app = createApp(App)

const UI = createWindiUI({
  registerComponents: false,
})

app.use(UI, windiTheme)

app.mount('#app')
  1. Head over to your vite.config.ts or vite.config.js file and add the following:
// other imports
import { WindiUIComponentResolver } from 'windi-vue'
import Components from 'unplugin-vue-components/vite'

export default defineConfig({
  plugins: [
    // other plugins
    Components({
      resolvers: [
        WindiUIComponentResolver()
      ]
    }),
  ],
})
  1. Now you can simply use any component that you want and it will be auto imported on demand ✨
<template>
  <div>
    <WKbd>K</WKbd>
  </div>
</template>

Troubleshooting TypeScript Error

If you're encountering the TypeScript error: Cannot find module 'windi-vue/dist/theme/windiTheme' or its corresponding type declarations, you can follow these steps to resolve it:

  1. Create a windi-vue.d.ts declaration file in your src directory and inside it paste the following code:
declare module 'windi-vue/dist/theme/windiTheme'

The error should now be resolved.

This issue is set to be fixed in the next release of Windi UI v0.0.1 Alpha

🥳 Well done, you can now go ahead and build your web application with ease.

Contributions

Contributions are welcome and encouraged! If you have any ideas or suggestions for new features, or if you encounter any bugs or issues, please open an issue or submit a pull request on the GitHub repository.

Developers interested in contributing should read the Code of Conduct and the Contributing Guide.

Credits

License

MIT License © 2023 Selemondev

windi-ui's People

Contributors

selemondev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

windi-ui's Issues

Accordion

An Accordion displays a list of high-level options that can expand or collapse to reveal more information about a subject or item.

ButtonGroup

A ButtonGroup is a component that groups multiple buttons together.

Playground

Create a playground where developers can test and play with the components before using them in their projects.

Auto Imports

By introducing the auto import feature, developers can now enjoy the convenience of auto component imports, eliminating the need to manually import components. This feature smartly imports components on demand, resulting in a streamlined and optimized final bundle. The bundle size is significantly reduced as it includes only those components that have been used, ensuring a faster-loading application.

Slideover

A Slideover is a UI component that displays a dialog that slides in from the edge of the screen.

AvatarGroup

An AvatarGroup component is a UI component commonly used to display a group of avatars together and also the developer can decide the max number of avatars to display and the remaining avatars will be represented in a numerical count.

Button

A Button component is used to trigger an action or event, such as submitting a form, opening a Dialog or a Modal, canceling an action, or performing a delete operation.

Icon Disappears When Hovering the `UVerticalNavigation` component

Describe the bug
For some reason, there is a noticeable issue with the UVerticalNavigation component. Whenever I hover over the UVerticalNavigation Icon element, the associated icon disappears, which is unexpected behavior.

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Add any other context about the problem here.

Kbd

A KBD UI component, also known as a keyboard UI component, is a user interface element that is designed to represent a keyboard or keyboard-like input

Switch

A Switch is a user interface element that allows users to toggle between two states, typically representing binary options such as on/off, enabled/disabled, or true/false. It provides a visual indication of the current state and allows users to change that state by clicking or tapping on the toggle.

Checkbox

A checkbox UI component is a user interface element that allows users to toggle between two possible states, usually representing binary options such as "checked" or "unchecked," "on" or "off," or "selected" or "not selected".

Modal

A Modal UI component is a user interface element used to display content or options that require attention or interaction from the user. It is typically presented as a dialog box that appears on top of the main content, temporarily blocking interaction with the rest of the application or webpage.

Input

An input UI component is a user interface element that is used to get user input in a text or number field.

FormGroup

A FormGroup is a UI component used to group related form controls, such as inputs, selects, and checkboxes, together.

Badge

A Badge is used to highlight an item's status for quick recognition.

Dark mode theme

All components should have built-in support for dark mode by default.

Alert Dialog

The AlertDialog component is utilized to forcefully interrupt the user's workflow, demanding a mandatory confirmation.

Alert

Alerts serve as a means to convey the status of something.

Tag

A tag UI component is an element used in user interfaces to represent and display tags or labels associated with certain items or categories.

Divider

A Divider UI component is an element used to separate content or sections in a user interface.

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.