Thanks for your interest in contributing to Headless UI! Please take a moment to review this document before submitting a pull request.
- Pull requests
- Monorepo
- Installation
- Coding standards
- Running tests
- Running playgrounds
- Scripts summary
Please ask first before starting work on any significant new features.
It's never a fun experience to have your pull request declined after investing a lot of time and effort into a new feature. To avoid this from happening, we request that contributors create an issue to first discuss any significant new features. This includes things like adding new components, exposing internal information, etc.
Also make sure that you are making changes to both the React and Vue versions so that we can ensure feature parity.
The Headless UI repo is a monorepo using npm workspaces.
You only require a npm install in the root directory to install everything you need.
npm installWe use prettier for making sure that the codebase is formatted consistently.
To automatically fix any style violations in your code, you can run:
npm lintNote: Whenever you commit, the lint check will run on all staged files.
Note: In CI, we will only check your code, and not write with the formatted files. If you want to just check, then you can either run npm run lint-check or CI=true npm run lint
You can run the test suite using the following commands:
npm run testYou can also run them for React or Vue individually:
npm run react test
# or
npm run vue testPlease ensure that the tests are passing when submitting a pull request. If you're adding new features to Headless UI, please include tests.
Currently the React playground (located in packages/playground-react) is a Next.js app that contains some examples which you can find in the pages directory. The Vue playground (located in packages/playground-vue) is a Vite app that contains some examples which you can find in the src/components directory.
You can launch them by running:
npm run react playground
# or
npm run vue playgroundThis will also start the necessary watchers so that you don't have to care about them.
Global scripts, and some aliases:
npm install: install all dependencies for all packagesnpm run clean: this will call allnpm run {package} cleancommandsnpm run build: this will call allnpm run {package} buildcommandsnpm run lint: this willlintall packagesnpm run test: this willtestall packagesnpm run test: run all jest testsnpm run test --watch: run all jest tests in interactive modenpm run test tabs: run all jest tests filtered bytabsnpm run test tabs --watch: run all jest tests in interactive mode filtered bytabs
Scripts per package:
npm run react: Prefix to run anything in the@headlessui/reactpackagenpm run react test: run all jest testsnpm run react test --watch: run all jest tests in interactive modenpm run react test tabs: run all jest tests filtered bytabsnpm run react test tabs --watch: run all jest tests in interactive mode filtered bytabsnpm run react build: build the final artefactsnpm run react lint: validate and fix the react codebase using prettiernpm run react watch: start a watcher for the react esm build- Note: this will be executed for you when using the
npm run react playground - Note: this is not required for jest. You will probably never need this
- Note: this will be executed for you when using the
npm run react playground: (alias) start a development server in theplayground-reactpackage- Note: this will also run
npm run react watchfor you, which means that you only need to executenpm run react playground
- Note: this will also run
npm run react clean: this will removedistfiles
npm run vue: Prefix to run anything in the@headlessui/vuepackagenpm run vue test: run all jest testsnpm run vue test --watch: run all jest tests in interactive modenpm run vue test tabs: run all jest tests filtered bytabsnpm run vue test tabs --watch: run all jest tests in interactive mode filtered bytabsnpm run vue build: build the final artefactsnpm run vue lint: validate and fix the vue codebase using prettiernpm run vue watch: start a watcher for the vue esm build- Note: this will be executed for you when using the
npm run vue playground - Note: this is not required for jest. You will probably never need this
- Note: this will be executed for you when using the
npm run vue playground: (alias) start a development server in theplayground-vuepackage- Note: this will also run
npm run vue watchfor you, which means that you only need to executenpm run react playground
- Note: this will also run
npm run vue clean: this will removedistfiles