Shoelace
A forward-thinking library of web components.
- Works with all frameworks
π§© - Works with CDNs
π - Fully customizable with CSS
π¨ - Includes an official dark theme
π - Built with accessibility in mind
βΏοΈ - Open source
πΈ
Designed in New Hampshire by Cory LaViska.
Documentation: shoelace.style
Source: github.com/shoelace-style/shoelace
Twitter: @shoelace_style
π₯Ύ
Shoemakers Shoemakers, or "Shoelace developers," can use this documentation to learn how to build Shoelace from source. You will need Node >= 14 to build and run the project locally. It is preferred, but not required, to use npm 7.
You don't need to do any of this to use Shoelace! This page is for people who want to contribute to the project, tinker with the source, or create a custom build of Shoelace.
If that's not what you're trying to do, the documentation website is where you want to be.
What are you using to build Shoelace?
Components are built with LitElement, a custom elements base class that provides an intuitive API and reactive data binding. The build is a custom script with bundling powered by esbuild.
Forking the Repo
Start by forking the repo on GitHub, then clone it locally and install dependencies.
git clone https://github.com/YOUR_GITHUB_USERNAME/shoelace
cd shoelace
npm install
Developing
Once you've cloned the repo, run the following command.
npm start
This will spin up the Shoelace dev server. After the initial build, a browser will open automatically. There is currently no hot module reloading (HMR), as browser's don't provide a way to reregister custom elements, but most changes to the source will reload the browser automatically.
The documentation is powered by Docsify, which uses raw markdown files to generate pages. As such, no static files are built for the docs.
Building
To generate a production build, run the following command.
npm run build
Creating New Components
To scaffold a new component, run the following command, replacing sl-tag-name
with the desired tag name.
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.
Contributing
Shoelace is an open source project and contributions are encouraged! If you're interesting in contributing, please review the contribution guidelines first.
License
Shoelace is designed in New Hampshire by Cory LaViska. Itβs available under the terms of the MIT license.
Designing, developing, and supporting this library requires a lot of time, effort, and skill. Iβd like to keep it open source so everyone can use it, but that doesnβt provide me with any income.
Therefore, if youβre using my software to make a profit, I respectfully ask that you help fund its development by becoming a sponsor. There are multiple tiers to choose from with benefits at every level, including prioritized support, bug fixes, feature requests, and advertising.
Whether you're building Shoelace or building something with Shoelace β have fun creating!
RFC: i18n
It's time to start thinking about i18n. This discussion will be scoped to localization, whereas #191 will focus on RTL support.
There is a need for common labels in components that need to be localized. An example is in dialog/drawer/tab/tag, which all feature a built-in close button. Currently, the buttons don't have a label so screen readers don't announce them properly.
Important: I don't expect there to be many terms, nor do I want users to rely on Shoelace to power their app's localization. At this point in the library's development, a simple solution is preferred over a robust one.
Updated to reflect new requirements and information.
feat: add new tree-view component
This PR adds a Tree and TreeItem components that allow user to display a hierarchical list of items, expanding and collapsing the nodes that have nested items.
The
sl-tree
component implements the API to interact with the whole tree, like the selection and the keyboard navigation. It has just a default slot that can containsl-tree-item
components, that represent the nodes of the tree.Each
sl-tree-item
can in turn contain othersl-tree-item
, allowing to the user to define nested trees. A tree item with nested nodes, can be expanded and collapsed.Closes #539
Code example
Appereance
Handler violations when using SL with SvelteKit
Describe the bug
I'm running into handler violations where event handlers took too much time to return (for instance
focusin
of modals and drawers taking seconds to process).To Reproduce I made repro repo available here https://github.com/brgrz/sl-bugs
Steps to reproduce the behavior:
[Violation] 'focusin' handler took 6519ms
in the Console (while this happens, the app will freeze preventing you to click on anything else)Expected behavior No freezes, no violations/timeouts
Desktop (please complete the following information):
2.0: Back to the basics (again)
TL;DR β now that browser support has improved for custom props and CSS grid, Shoelace 2.0 will go back to its roots and once again be highly customizable without the need for any sort of build process.
As Shoelace evolved, it became clear that we weren't quite ready for certain CSS features in production. I feel I was a bit too premature with pushing Custom Properties and CSS Grid Layout when Shoelace was released back in July, but I think we're ready to move these features to the mainstream.
Edge 16 was released on October 16, and with it brings full support for Custom Properties and CSS Grid Layout. This doesn't include IE11, but I'm OK with that at this point.
Here's what I'd like to do moving forward:
<button class="btn">
) for default components. My updated thoughts on this: styling is easier, implementing is easier, and the "namespace" has some benefits.This is a bit of a backpedal, but I think it's finally time. Of course, this will introduce a breaking change in terms of browser support, so the new version will be 2.0.
Thoughts?
Create React App doesn't work out of the box with Shoelace
UPDATE: The original issue mentioned below has been resolved, but a new issue was uncovered regarding Create React App + Shoelace. See below for more details.
Jump to the latest issue π
View original issue
Describe the bug
After updating to 2.0.0-beta.86, getting import error (probably due to recent package.json exports field changes, using vite 3.2.5).
Importing like this:
Produces this error:
This can be fixed by changing the import to this:
Possible solutions
./dist/react.js
file, add that to the exports and import using@shoelace-style/shoelace/dist/react.js
Style tag injected into document head
Describe the bug
Importing a shoelace component inserts a
<style>
tag into the document<head>
.If shoelace components are being used in a shadow root, then this style won't have any effect.
Would it be possible to include these styles in the default stylesheet instead?
(I see it used to be in https://unpkg.com/browse/@shoelace-style/[email protected]/dist/themes/base.css, but now it's a separate and automatically inserted into the
<head>
from https://unpkg.com/browse/@shoelace-style/[email protected]/dist/styles/component.styles.js).This isn't strictly causing a problem because the class names are unique enough, but I did find it a little odd and seemingly unnecessary, and it violates the principle of encapsulation.
To Reproduce
Observe new style tag in head:
sl-datepicker component
Added the
sl-datepicker
component to shoelace library. ~~This pull request don't include the component doc~~. Fixed timezone issue with date https://github.com/shoelace-style/shoelace/issues/467#issuecomment-870958811Other relevant commits:
RTL Support via Logical CSS Properties
Is your feature request related to a problem? Please describe. Internationalization and the adaptation of UTF-8 became a necessity for Multilanguage apps. a support for RTL in shoelace in its early stage in development will be great added advantage for developers.
Describe the solution you'd like is it possible to put it under consideration while the project still in its alpha. As RTL support is lacked from many frameworks including Bootstrap.
Describe alternatives you've considered using custom css on top of shoelace. please consider this site https://rtlcss.com/playground/
Tree shake big bundle size
I'm trying the amazing Shoelace for the first time today.
I'm working on a project with Rollup.
Everything works and is amazing.
One thing I don't like though.
Just adding the following lines of code to my project increases it by 232 KB (from 747 KB to 979 KB) javascript side only.
If I use this instead it increases by 383 KB (from 747 KB to 1130 KB).
As you can see from the images we have
@stencil/core/internal/client/index.js
of ~ 16 KB. Is it really needed?Is it really necessary to have those 232 KB all together? Can we tree-shaking?
Chrome freezes when dropping down select
Describe the bug
Under certain conditions, if the dropdown of an
SlSelect
is dropped down, Chrome will freeze in an infinite loop.To Reproduce
Steps to reproduce the behavior:
If this doesn't happen, go into Responsive Design mode and reduce the viewport size as shown below.
Screenshots
Browser / OS
Additional information
This doesn't seem to happen in Firefox. From what I could tell, this seems to be an infinite loop in https://github.com/floating-ui/floating-ui
sl-details open="true" fails in beta.28+
Describe the bug Loading a
sl-details
with it's body open on init worked prior tobeta.28
. See this video:From
beta.28
on it's initialized with only a portion of the body content visible. On subsequent open/close class it's fine:Expected behavior Inits with body content fully visible with
open="true"
.Desktop (please complete the following information):
`` triggers click/tap events
Describe the bug
<sl-menu-item disabled>
is ignored. Tested in versions.88
β.61
(likely goes further past).To Reproduce
Steps to reproduce the behavior:
<sl-menu-item disabled>
is ignored!<β― disabled>
prevents event.Demo
See above.
Screenshots
N/A.
Browser / OS
Additional information
Discovered while adding support for
<sl-menu-item inert>
in https://github.com/shoelace-style/shoelace/issues/1107#issuecomment-1374806787Export `assets/icons/*` from package
What issue are you having?
A bit of an obscure use case, but: I like to import some of the icons directly as raw SVG to use them directly in the code without depending on external files.
However,
dist/assets/icons/*
ist not part of theexports
field inpackage.json
, sovite
rejects importing it. For Vite, this is intended behaviour and they won't change it.Describe the solution you'd like
I'd like to simply adjust Shoelace's
package.json
to export the icons.Describe alternatives you've considered
Right now, I am manually changing Shoelace's
package.json
, which is not great on many levels.Document remaining design tokens
Many 2.0 design tokens have been documented already, but there are a lot that haven't. I propose adding a new page in the docs for miscellaneous tokens with name and descriptions, including tips on how to style common things such as button/input heights.
Improve Tests
Before 2.0 stable lands, more tests are needed. Any help here will be appreciated, as I'm currently doing this solo.
docs/resources/contributing.md
I don't care about the number of tests or even coverage β I care about sensibility and making sure the important things are covered.
If you plan on assisting with this, please post below so we can coordinate. Thanks!
Tests are currently failing on Windows
To repro, run the following on a Windows machine not using WSL:
This was reported by a user and also fails on my Windows machine. Apologies, but I don't have the error handy to paste here.