--- meta: title: Contributing description: Shoelace is an open source project, meaning everyone can use it and contribute to its development. --- # Contributing Shoelace is an open source project, meaning everyone can use it and contribute to its development. When you join our community, you'll find a friendly group of enthusiasts at all experience levels who are willing to chat about anything and everything related to Shoelace. The easiest way to get started contributing is to join the [community chat](https://discord.gg/mg8f26C). This is where we hang out, discuss new ideas, ask for feedback, and more! A common misconception about contributing to an open source project is that you need to know how to code. This simply isn't true. In fact, there are _many_ ways to contribute, and some of the most important contributions come from those who never write a single line of code. Here's a list of ways you can make a meaningful contribution to the project: - Submitting well-written bug reports - Submitting feature requests that are within the scope of the project - Improving the documentation - Responding to users that need help in the community chat or discussion forum - Triaging issues on GitHub - Being a developer advocate for the project - Sponsoring the project financially - Writing tests - Sharing ideas - And, of course, contributing code! Please take a moment to review these guidelines to make the contribution process as easy as possible for both yourself and the project's maintainers. ## AI-generated Code As an open source maintainer, I respectfully ask that you refrain from using AI-generated code when contributing to this project. This includes code generated by tools such as GitHub Copilot, even if you make alterations to it afterwards. While some of Copilot's features are indeed convenient, the ethics surrounding which codebases the AI has been trained on and their corresponding software licenses remain very questionable and have yet to be tested in a legal context. I realize that one cannot reasonably enforce this any more than one can enforce not copying licensed code from other codebases, nor do I wish to expend energy policing contributors. I would, however, like to avoid all ethical and legal challenges that result from using AI-generated code. As such, I respectfully ask that you refrain from using such tools when contributing to this project. At this time, I will not knowingly accept any code that has been generated in such a manner. ## Using the Issue Tracker The [issue tracker](https://github.com/shoelace-style/shoelace/issues) is for bug reports, feature requests, and pull requests. - Please **do not** use the issue tracker for personal support requests. Use [the discussion forum](https://github.com/shoelace-style/shoelace/discussions/categories/help) instead. - Please **do not** use the issue tracker for feature requests. Use [the discussion forum](https://github.com/shoelace-style/shoelace/discussions/categories/ideas) instead. - Please **do not** derail, hijack, or troll issues. Keep the discussion on topic and be respectful of others. - Please **do not** post comments with "+1" or "👍". Use [reactions](https://github.blog/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/) instead. - Please **do** use the issue tracker for feature requests, bug reports, and pull requests. Issues that do not follow these guidelines are subject to closure. There simply aren't enough resources for the author and contributors to troubleshoot personal support requests. ### Feature Requests Feature requests can be added using [the discussion forum](https://github.com/shoelace-style/shoelace/discussions/categories/ideas). - Please **do** search for an existing request before suggesting a new feature. - Please **do** use the voting buttons to vote for a feature. - Please **do** share substantial use cases and perspective that support new features if they haven't already been mentioned. - Please **do not** bump, spam, or ping contributors to prioritize your own feature. ### Bug Reports A bug is _a demonstrable problem_ caused by code in the library. Bug reports are an important contribution to the quality of the project. When submitting a bug report, there are a few steps you can take to make sure your issues gets attention quickly. - Please **do not** paste in large blocks of irrelevant code - Please **do** search for an existing issue before creating a new one - Please **do** explain the bug clearly - Please **do** provide a minimal test case that demonstrates the bug (e.g. [jsfiddle.net](https://jsfiddle.net/) or [CodePen](https://codepen.io/)) - Please **do** provide additional information, when necessary, to replicate the bug **A minimal test case is critical to a successful bug report.** It demonstrates that the bug exists in the library and not in surrounding code. Contributors should be able to understand the bug without studying your code, otherwise they'll probably move on to another bug. ### Pull Requests To keep the project on track, please consider the following guidelines before submitting a PR. - Please **do not** submit a PR without opening an issue first, unless the changes are trivial (e.g. fixing typos or outdated docs). This may prevent you from doing work that won't be accepted for various reasons (e.g. someone is already working on it, it's not a good fit for the project's roadmap, it needs additional planning, etc.) - Please **do** make sure your PR clearly defines what you're changing. Even if you feel your changes are obvious, please explain them so other contributors can more easily review your works. PRs without detailed descriptions are subject to closure pending more details. - Please **do** open your PR against the `next` branch. - Please **do not** edit anything in `dist/`. These files are generated automatically, so you need to edit the source files instead. The author reserves the right to reject any PR that's outside the scope of the project or doesn't meet code quality standards. ### Branches `current` - This branch reflects the latest release and powers [shoelace.style](https://shoelace.style/). `next` - This is the branch you should submit pull requests against. It reflects what's coming in the _next_ release, which can be previewed at [next.shoelace.style](https://next.shoelace.style/). ## Developing To set up a local dev environment, [fork the repo](https://github.com/shoelace-style/shoelace/fork) on GitHub, clone it locally, and install its dependencies. ```bash git clone https://github.com/YOUR_GITHUB_USERNAME/shoelace cd shoelace npm install ``` Once you've cloned the repo, run the following command to spin up the dev server. ```bash npm start ``` After the initial build, a browser will open automatically to a local version of the docs. The documentation is powered by Eleventy and a number of custom plugins. ### Cloud-based Development Alternatively, you can use [Gitpod](https://www.gitpod.io/) to setup a dev environment in the cloud using only your browser. [![Open in Gitpod](/assets/images/gitpod.svg)](https://gitpod.io/#https://github.com/shoelace-style/shoelace) ### Creating New Components To scaffold a new component, run the following command, replacing `sl-tag-name` with the desired tag name. ```bash npm run create sl-tag-name ``` This will generate a source file, a stylesheet, and a docs page for you. When you start the dev server, you'll find the new component in the "Components" section of the sidebar. ### Dev Sandbox Component development occurs _within_ the local docs site. I've found that offering common variations _in the docs_ is more beneficial for users than segmenting demos and code examples into separate tools such as Storybook. This encourages more thorough documentation, streamlines development for maintainers, and simplifies how the project is built. It also reduces installation and startup times significantly. There is currently no hot module reloading (HMR), as browsers don't provide a way to unregister custom elements. However, most changes to the source will reload the browser automatically. For more information about running and building the project locally, refer to `README.md` in the project's root. ### Testing Shoelace uses [Web Test Runner](https://modern-web.dev/guides/test-runner/getting-started/) for testing. To launch the test runner during development, open a terminal and launch the dev server. ```bash npm start ``` In a second terminal window, launch the test runner. ```bash npm run test:watch ``` Follow the on-screen instructions to work with the test runner. Tests will automatically re-run as you make changes. To run all tests only once: ```bash npm run test ``` To test a single component, use the component's basename as shown in the following example. ```bash npm run test:component breadcrumb-item ``` ## Documentation Maintaining good documentation can be a painstaking task, but poor documentation leads to frustration and makes the project less appealing to users. Fortunately, writing documentation for Shoelace is fast and easy! Most of Shoelace's technical documentation is generated with JSDoc comments and TypeScript metadata from the source code. Every property, method, event, etc. is documented this way. In-code comments encourage contributors to keep the documentation up to date as changes occur so the docs are less likely to become stale. Refer to an existing component to see how JSDoc comments are used in Shoelace. Instructions, code examples, and interactive demos are hand-curated to give users the best possible experience. Typically, the most relevant information is shown first and less common examples are shown towards the bottom. Edge cases and gotchas should be called out in context with tips or warnings. The docs are powered by [Eleventy](https://www.11ty.dev/). Check out `docs/components/*.md` to get an idea of how pages are structured and formatted. If you're creating a new component, it may help to use an existing component's markdown file as a template. If you need help with documentation, feel free to reach out on the [community chat](https://discord.gg/mg8f26C). ### Shoelace-flavoured Markdown The Shoelace documentation uses an extended version of [markdown-it](https://github.com/markdown-it/markdown-it). Generally speaking, it follows the [Commonmark spec](https://spec.commonmark.org/) while sprinkling in some additional features. #### Code Previews To render a code preview, use the standard code field syntax and append `:preview` to the language. ````md ```html:preview [code goes here] ``` ```` You can also append `:expanded` to expand the code by default, and `:no-codepen` to disable the CodePen button. The order of these modifiers doesn't matter, but no spaces should exist between the language and the modifiers. ````md ```html:preview:expanded:no-codepen [code goes here] ``` ```` This particular syntax was chosen for a few reasons: 1. It's easy to remember 2. It works out of the box with markdown-it 3. It appears to have the best support across editors and previewers (the language is usually highlighted correctly) #### Callouts Special callouts can be added using the following syntax. ``` :::tip This is a tip/informational callout ::: :::warning This is a warning callout ::: :::danger This is a danger callout ::: ``` #### Asides To place content that's indirectly related, use the following syntax. ``` :::aside This content is indirectly related and will appear in an `