Shoelace Components
This package simplifies the use of Shoelace library web components. For better component preview, visit sl.toddle.site in a separate tab.
Theme:
All Components
Changelog
Components
Components
Alert
Animation
Avatar
Badge
Breadcrumb
Button
Carousel
Checkbox
Color Picker
Copy Button
Details (Accordion)
Dialog
Drawer
Dropdown
Icon
Icon Button
Image Comparer
Menu
Progress Bar
Progress Ring
QR Code
Range Slider
Rating
Select
Skeleton
Spinner
Split Panel
Switch
Tabs
Tag
Tooltip
Tree
*For feedback or bug reports, contact me on Discord: kamilnader
Components
Alert
Alerts are used to display important messages.
Success!
I will be gone based on duration set!
This is super informative
You can tell by how pretty the alert is.
Your changes have been saved
You can safely exit the app now.
Your settings have been updated
Settings will take effect on next login.
Your session has ended
Please login again to continue.
Your account has been deleted
We’re very sorry to see you go!
Attributes
show-icon | Boolean value: "true" = show icon. "false" = hide icon. |
icon | Icon name: Find your icon here: icons.getbootstrap.com |
theme | "light" or "dark". |
isopen | Boolean ("true"/ "false"). Show or Hide on page load. |
Variant | Choose between: ("primary", "success", "neutral", "warning", "danger"). |
closable | Boolean ("true"/"false"). Show or hide close icon. |
id | Set the ID of alert (Useful for Toast effect). |
Actions
showAlert | Action accepts id of alert. Upon calling the action, the alert will show. Tip: Set the parent element of the alert to fixed to have the toast effect. |
Animation
Animate any element.
Animate text
Attributes
name | Animation name. Animations are based on those found in the popular Animate.css library: https://animate.style/ |
play | Boolean ("true", "false"). Play on load. |
easing | Example: "easeInOut". |
duration | In milliseconds. |
iterations | number to repeat. |
Avatar
Avatars are used to represent a person or object.
Attributes
show-icon | Boolean ("true"/"false"). |
icon | Icon name: Find your icon here: icons.getbootstrap.com |
image | URL of the image. |
label | For assistive devices. |
shape | Choose between: "rounded", "square", "circle". |
theme | "light" or "dark". |
initials | Instead of icon or image you can also use Initials. Example: (KN). |
Badge
Badges are used to draw attention and display statuses or counts.
Attributes
pill | Boolean value. Draws a pill-style badge with rounded edges. |
pulse | Boolean value. Makes the badge pulsate to draw attention. |
theme | "light" or "dark". |
variant | Choose between: ("primary", "success", "neutral", "warning", "danger"). |
slot | This is only used if the badge is nested within another Shoelace component. For example: within the Menu Item component, it can be placed to the left as "prefix" and to the right as "suffix. |
Breadcrumb
Breadcrumbs provide a group of links so users can easily navigate a website’s hierarchy. You can use icon component for changing default separator.
Attributes (breadcrumb)
theme | light or dark. |
label | The label to use for the breadcrumb control. This will not be shown on the screen, but it will be announced by screen readers and other assistive devices to provide more context for users. |
Attributes (breadcrumb-item)
href | Optional URL to direct the user to when the breadcrumb item is activated. When set, a link will be rendered internally. When unset, a button will be rendered instead. |
target | Tells the browser where to open the link. Only used when href is set. Choose between: '_blank' | '_parent' | '_self' | '_top' | undefined |
rel | The rel attribute to use on the link. Only used when href is set. Defualt is: 'noreferrer noopener' |
Button
Buttons represent actions that are available to the user.
Attributes
icon | Empty no icon or pass the Icon name: Find your icon here: icons.getbootstrap.com |
icon-position | "left" or "right". |
link | This adds href attribute, which will make the component render an <a> under the hood. This gives you all the default link behavior the browser provides (e.g. CMD/CTRL/SHIFT + CLICK) and exposes the target and download attributes. |
size | Choose between: "small", "medium", "large". |
shape | Choose between: "pill" and "circle". |
theme | "dark" or "light". |
loading | Boolean ("true"/ "false"). Draws the button in a loading state. |
outline | Boolean ("true"/ "false"). Draws an outlined button. |
variant | Choose between: ("primary", "success", "neutral", "warning", "danger"). |
disabled | Boolean ("true"/ "false"). Disables the button. |
download_file_name | Name of the file downloaded. |
link_open_new_tab | Boolean ("true"/ "false"). |
class | You can add a custom class to the button. |
id | You can add a custom id to the button. |
slot | Example usage: when a button is a child of a dropdown component, the slot attribute should be set to "trigger"" |
Events
click | Button click event |
Carousel
Carousels display an arbitrary number of content slides along a horizontal or vertical axis.
Attributes
loop | Boolean value. When set, allows the user to navigate the carousel in the same direction indefinitely. |
style |
Use the --aspect-ratio custom property to customize the size of the carousel’s viewport from the default value of 16/9. --aspect-ratio: 3/2; or --aspect-ratio: 1/1; |
theme | "light" or "dark". |
images | Array of images |
autoplay | Boolean value. The carousel will automatically advance when the autoplay attribute is used. |
navigation | Boolean value. When set, show the carousel’s navigation. |
pagination | Boolean value. When set, show the carousel’s pagination indicators. |
slides-per-move | Advance more than once slide at a time. |
slides-per-page | Specifies how many slides should be shown at a given time. |
autoplay-interval | Specifies the amount of time, in milliseconds, between each automatic scroll. |
Events (Coming soon)
eventName | Description of event |
Checkbox
Checkboxes allow the user to toggle an option on or off.
Attributes
size | Choose between: "small", "medium", "large". |
theme | "light" or "dark". |
checked | Boolean value. Draws the checkbox in a checked state. |
indeterminate | Boolean value. Draws the checkbox in an indeterminate state. This is usually applied to checkboxes that represents a “select all/none” behavior when associated checkboxes have a mix of checked and unchecked states. |
disabled | Boolean value. Disables the checkbox. |
help-text | The checkbox’s help text. If you need to display HTML, use the help-text slot instead. |
required | Makes the checkbox a required field. |
class | Add class name for additional styling. |
Events
checked |
Emitted when the checked state changes. Output: True or False |
Color Picker
Color pickers allow the user to select a color.
Attributes
size |
Choose between: "small", "medium", "large". |
label | The color picker’s label. This will not be displayed, but it will be announced by assistive devices. |
theme | "light" or "dark". |
value | The current value of the color picker. |
format | Valid options include hex, rgb, hsl, and hsv. |
inline | Renders the color picker inline rather than in a dropdown. |
swatches | One or more predefined color swatches to display as presets in the color picker. Can include any format the color picker can parse, including HEX(A), RGB(A), HSL(A), HSV(A), and CSS color names. Each color must be separated by a semicolon (;). |
show-opacity | Boolean (true, false). Shows the opacity slider. Enabling this will cause the formatted value to be HEXA, RGBA, or HSLA. |
Events
sl-change | Emitted when the color picker’s value changes. |
Copy Button
Copies text data to the clipboard when the user clicks the trigger. Color is taken from the parent element.
Attributes
value_to_copy | Copies text data to the clipboard when the user clicks the trigger. |
copy_from_id | You can copy content from other elements on the page by passing the id of the element. If you want to copy the value of the input element, then pass the id.value. If you want to copy the link from a tag, then enter id.[href] |
disabled | Boolean ("true"/ "false"). Disables the copy button. |
custom_icons | Boolean ("true"/ "false"). Enables option to add custom icon for copy-icon, error-icon and success-icon. |
copy-icon | The icon to show in the default copy state. icons.getbootstrap.com |
error-icon | The icon to show when a copy error occurs. icons.getbootstrap.com |
success-icon | The icon to show when the content is copied. icons.getbootstrap.com |
copy-tooltip | Copy buttons displayed feedback in a tooltip. You can customize the label when hover or click. |
error-tooltip | Copy buttons displayed feedback in a tooltip. You can customize the label when there is an error. |
success_tooltip | Copy buttons displayed feedback in a tooltip. You can customize the label when there is a success. |
Events (Coming soon)
eventName |
Description of event |
Details
Details show a brief summary and expand to show additional content.
This is a paragraph of text
This is a paragraph of text
This is a paragraph of text
Attributes
theme | "light" or "dark". |
sumarry | The summary to show in the header. If you need to display HTML, use the summary slot instead. |
disabled | Boolean ("true"/ "false"). Disables the details so it can’t be toggled. |
accordion-logic | Boolean ("true"/ "false"). Details are designed to function independently, but you can simulate a group or “accordion” where only one is shown at a time. |
Dialog (Modal)
Dialogs, sometimes called “modals”, appear above the page and require the user’s immediate attention.
This is a paragraph of text
To trigger dialog you need to put button next to dialog component. After that you can nest dialog main content inside dialog component. You can also nest button and set it's slot to "footer". This will Close the dialog on button click. You can also nest icon-button component and set it's slot to "header-actions". This will add aditional links in the header. When using slots that are not default, use components slots attributes instead of toddle slots feature
Attributes
theme | "light" or "dark". |
label | The dialog’s label as displayed in the header. You should always include a relevant label. If you need to display HTML, use the label slot instead. The label inherits color from parent element. |
style |
--width The preferred width of the dialog. Note that the dialog will shrink to accommodate smaller screens. --header-spacing The amount of padding to use for the header. --body-spacing The amount of padding to use for the body. --footer-spacing The amount of padding to use for the footer. |
id | Dialog ID. Useful for Actions for opening and closing. |
Actions
-
openDialogByID
Open dialog
Arguments
id dialog id -
hideDialogById
Hide dialog. Useful for hiding dialog inside dialog. Or having a flow of dialogs.
Arguments
id dialog id
Drawer
Drawers slide in from a container to expose additional options and information.
This is a paragraph of text
This is a paragraph of text
This is a paragraph of text
This is a paragraph of text
To trigger drawer you need to put button next to drawer component. After that you can nest drawer's main content inside drawer component. You can also nest button and set it's slot to "footer". This will Close the drawer on button click. You can also nest icon-button component and set it's slot to "header-actions". This will add aditional links in the header. When using slots that are not default, use components slots attributes instead of toddle slots feature
Attributes
theme | "light" or "dark". |
label | The drawer's label as displayed in the header. You should always include a relevant label. If you need to display HTML, use the label slot instead. The label inherits color from parent element. |
placement | The direction from which the drawer will open. 'top' | 'end' | 'bottom' | 'start'. Default is 'end'. |
style |
--size The preferred size of the drawer. This will be applied to the drawer’s width or height depending on its placement. Note that the drawer will shrink to accommodate smaller screens. --header-spacing The amount of padding to use for the header. --body-spacing The amount of padding to use for the body. --footer-spacing The amount of padding to use for the footer. |
id |
Drawer ID. Useful for Actions for opening and closing. |
Actions
-
openDrawerById
Open drawer
Arguments
id drawer id -
hideDrawerById
Hide drawer. Useful for hiding drawer inside drawer. Or having a flow of drawers.
Arguments
id drawer id
Dropdown
Dropdowns expose additional content that “drops down” in a panel.
Dropdowns consist of a trigger and a panel. By default, activating the trigger will expose the panel and interacting outside of the panel will close it.
All dropdowns contain two elements. In the above example: a Button and a Menu, both children of the Dropdown. The Button should have its 'slot' attribute set to 'trigger'.
Attributes
theme | dark or light. |
placement | The preferred placement of the dropdown panel. Note that the actual placement may vary as needed to keep the panel inside of the viewport. Choose between: 'top' | 'top-start' | 'top-end' | 'bottom' | 'bottom-start' | 'bottom-end' | 'right' | 'right-start' | 'right-end' | 'left' | 'left-start' | 'left-end' |
distance | The distance from the panel to the trigger can be customized using the distance attribute. This value is specified in pixels. |
disabled | Boolean value: Disables the dropdown so the panel will not open. |
skidding | The offset of the panel along the trigger can be customized using the skidding attribute. This value is specified in pixels. |
hoist | Boolean value: Enable this option to prevent the panel from being clipped when the component is placed inside a container with overflow: auto|scroll. Hoisting uses a fixed positioning strategy that works in many, but not all, scenarios. |
Events
sl-select | When dropdowns are used with menus, you can listen for the sl-select event to determine which menu item was selected. |
Icon
Icons are symbols that can be used to represent various options within an application. Shoelace comes bundled with over 1,500 icons courtesy of the Bootstrap Icons project. Color is taken from the parent element.
Attributes
icon-name | Icon name: Find your icon here: icons.getbootstrap.com |
label | An alternate description to use for assistive devices. If omitted, the icon will be considered presentational and ignored by assistive devices. |
style | Icons inherit their color from the current text color. Icons are sized relative to the current font size. |
slot | Use if needed, when icon is child of another SL component. |
Icon Button
Icons buttons are simple, icon-only buttons that can be used for actions and in toolbars. Color is taken from the parent element.
Attributes
icon-name | Icon name: Find your icon here: icons.getbootstrap.com |
label | An alternate description to use for assistive devices. If omitted, the icon will be considered presentational and ignored by assistive devices. |
style | Icons inherit their color from the current text color. Icons are sized relative to the current font size. |
link | Convert the button to a link. Enter URL. |
link-new-tab | Boolean field. True for opening in new tab. |
disabled | Boolean field. Use the disabled attribute to disable the icon button. |
slot | Only needed if you are using icon-button as a child of other shoelace component. |
Image Comparer
Compare visual differences between similar photos with a sliding panel.
Attributes
theme | "light" or "dark". |
position | The position of the divider as a percentage. |
Menu
Menus provide a list of options for the user to choose from. Menu is made of multiple components (menu, menu-item, divider, menu-label).
Attributes (menu)
theme | dark or light. |
submenu | Boolean value. True for having menu inside menu. |
style | Set width of the menu. Example: "max-width: 200px;" or "width: 200px;" |
Attributes (menu-item)
value | The value attribute can be used to assign a hidden value, such as a unique identifier, to a menu item. When an item is selected, the sl-select event will be emitted and a reference to the item will be available. |
type | The type of menu item to render. To use checked, this value must be set to "checkbox". Default is "normal". |
checked | Boolean value. Draws the item in a checked state. |
loading | Boolean value. Draws the menu item in a loading state. |
disabled | Boolean value. Draws the menu item in a disabled state, preventing selection. |
Attributes (divider)
vertical | Boolean value. Draws the divider in a vertical orientation. |
style | Use the --width custom property to change the width of the divider. Use the --color custom property to change the color of the divider. Use the --spacing custom property to change the amount of space between the divider and it’s neighboring elements. |
Events
sl-select | Emitted when a menu item is selected. The output is the value of the menu-item |
Progress Bar
Progress bars are used to show the status of an ongoing operation.
Attributes
label | A custom label for assistive devices. |
style |
--height : The progress bar’s height. --track-color : The color of the track. --indicator-color : The color of the indicator. --label-color: The color of the label. |
theme | "light" or "dark". |
value | The current progress as a percentage, 0 to 100. |
indeterminate | Boolean ("true"/ "false"). When true, percentage is ignored, the label is hidden, and the progress bar is drawn in an indeterminate state. |
Progress Ring
Progress rings are used to show the progress of a determinate operation in a circular fashion.
Attributes
label | A custom label for assistive devices. |
style |
--size : The diameter of the progress ring (cannot be a percentage). --track-width : The width of the track. --track-color : The color of the track. --indicator-width : The width of the indicator. Defaults to the track width. --indicator-color : The color of the indicator. --indicator-transition-duration : The duration of the indicator’s transition when the value changes. |
theme | "light" or "dark". |
value | The current progress as a percentage, 0 to 100. |
QR Code
QR codes are useful for providing small pieces of information to users who can quickly scan them with a smartphone. Most smartphones have built-in QR code scanners, so simply pointing the camera at a QR code will decode it and allow the user to visit a website, dial a phone number, read a message, etc.
Attributes
value | The QR code’s value. |
label | The label for assistive devices to announce. If unspecified, the value will be used instead. |
label | Use the placement attribute to set the preferred placement of the tooltip. ("top-start", "top", "top-end", "left-start", "right-start", "left", "right", "left-end", "right-end", "bottom-start", "bottom", "bottom-end"). |
size | The size of the QR code, in pixels. Default is "128". |
fill | The fill color. This can be any valid CSS color. |
background | The background color. This can be any valid CSS color or transparent. |
radius | The edge radius of each module. Must be between 0 and 0.5. |
error-correction | The level of error correction to use. Learn more |
Range Slider
Ranges allow the user to select a single value within a given range using a slider.
Attributes
max | The maximum acceptable value of the range. |
min | The minimum acceptable value of the range. |
step | The interval at which the range will increase and decrease. |
label | The range’s label. |
style |
--thumb-size : The size of the thumb. --tooltip-offset: The vertical distance the tooltip is offset from the track. --track-color-active: The color of the portion of the track that represents the current value. --track-color-inactive: The of the portion of the track that represents the remaining value. --track-height: The height of the track. --track-active-offset: The point of origin of the active track. |
theme | "light" or "dark". |
tooltip | The preferred placement of the range’s tooltip. "top" or "bottom". |
disabled | Disables the range. |
Events (Coming soon)
eventName | Description of event |
Rating
Ratings give users a way to quickly view and provide feedback.
Attributes
theme | "light" or "dark". |
max | The highest rating to show. |
value | The current rating. |
precision | The precision at which the rating will increase and decrease. For example, to allow half-star ratings, set this attribute to 0.5. |
label | A label that describes the rating to assistive devices. |
show-icon | Boolean value. True/False. True for custom icon. Enter the icon name in icon attribute. |
icon | Icon name: Find your icon here: icons.getbootstrap.com |
style | Adjust the size: "--symbol-size: 2rem;" |
disabled | Disable the rating. |
readonly | Makes the rating readonly. |
Events (Coming soon)
eventName | Description of event |
Select
Selects allow you to choose items from a menu of predefined options.
Attributes
pill | Boolean value. Give selects rounded edges. |
size | Choose between: small, medium, large. |
label | The select’s label. |
theme | "light" or "dark". |
filled | Boolean value. Draws a filled select. |
disabled | Boolean ("true"/ "false"). |
clearable | Boolean ("true"/ "false"). Make the control clearable. |
help-text | The select’s help text. |
placement | The preferred placement of the select’s menu. "top" or "bottom". |
placeholder | Placeholder text to show as a hint when the select is empty. |
multiple | Boolean value. True for selecting multiple options. |
value | set the inital value of select |
required | Boolean field. Makes the select a required field in a form. |
Events
sl-select | Emitted when a select option is selected. The output is option value. |
Skeleton
Skeletons are used to provide a visual representation of where content will eventually be drawn.
Attributes
style |
--border-radius : The skeleton’s border radius. --color : The color of the skeleton. --sheen-color : The sheen color when the skeleton is in its loading state. |
theme | "light" or "dark". |
effect | Determines which effect the skeleton will use. There are two built-in effects, "sheen" and "pulse". The default is "none", which displays a static, non-animated skeleton. |
Spinner
Spinners are used to show the progress of an indeterminate operation.
Attributes
style |
--font-size: sized based on the current font size. --track-width: The width of the track. --track-color: The color of the track. --indicator-color: The color of the spinner’s indicator. --speed: The time it takes for the spinner to complete one animation cycle. |
theme | "light" or "dark". |
Split Panel
Split panels display two adjacent panels, allowing the user to reposition them.
The Split Panel component consists of 2 child elements. Each child must have a slot set to "start" or "end," and the overflow needs to be set to "hidden."
Set slots on attributes level and on Toddle slots section.
Attributes
theme | "light" or "dark". |
initial_position | To set the initial position, use the position attribute. If no position is provided, it will default to 50% of the available space. Example: "30" would equal to 30%. |
snap | To snap panels at specific positions while dragging, add the snap attribute with one or more space-separated values. Values must be in pixels or percentages. For example, to snap the panel at 100px and 50%, enter value: "100px 50%". |
disabled | Boolean ("true"/ "false"). Prevent the divider from being repositioned. |
style |
To set a minimum or maximum size of the primary panel, use the --min and --max custom properties. Since the secondary panel is flexible, size constraints can only be applied to the primary panel. If no primary panel is designated, these constraints will be applied to the start panel. You can also set the width of divider: --divider-width |
Switch
Switches allow the user to toggle an option on or off.
Attributes
size | Choose between: "small", "medium", "large". |
style |
--width : The width of the switch. --height : The height of the switch. --thumb-size : The size of the thumb. |
theme | "light" or "dark". |
checked | Boolean value. Draws the switch in a checked state. |
disabled | Boolean value. Disables the switch. |
help-text | The switch’s help text. |
required | Boolean field. Makes the switch a required field in a form. |
Events
checked | Emitted when the control’s checked state changes. Output True or False |
Tabs
Tabs organize content into a container that shows one section at a time.
Top Position
You can place any content in tab
Settings
Security Section
Bottom Position
You can place any content in tab
Settings
Security Section
Start Position
You can place any content in tab
Settings
Security Section
To structure a tab, you first need to add a tab-group component. Inside the tab-group, you add tab and tab-panel components. In the attributes, make sure that the tab panel attribute is the same as the tab-panel name attribute.
Attributes: tab-group
placement | The placement of the tabs. Choose between: 'top' | 'bottom' | 'start' | 'end' |
theme | dark or light. |
style |
--indicator-color The color of the active tab indicator. --track-color The color of the indicator’s track (the line that separates tabs from panels). --track-width The width of the indicator’s track (the line that separates tabs from panels). |
Attributes: tab
panel | The name of the tab panel this tab is associated with. The panel must be located in the same tab group. |
disabled | Disables the tab and prevents selection. |
Attributes: tab-panel
name | The tab panel’s name. |
Actions
-
showTabPanel
Open specific panel in tabs.
Arguments
tabGroupId Tab Group component ID. panel Name of the panel to show.
Tag
Tags are used as labels to organize things or to indicate a selection.
Primary
Success
Neutral
Warning
Danger
Attributes
pill | Boolean value. Draws a pill-style tag with rounded edges. |
size | The tag’s size. Choose between: "small", "medium", "large". |
theme | "light" or "dark". |
variant | Choose between: ("primary", "success", "neutral", "warning", "danger"). |
Tooltip
Tooltips display additional information based on a specific action.
Attributes
theme | "light" or "dark". |
content | Tooltip content. |
trigger | Set the trigger attribute to "click"to toggle the tooltip on click instead of hover. |
placement | Use the placement attribute to set the preferred placement of the tooltip. ("top-start", "top", "top-end", "left-start", "right-start", "left", "right", "left-end", "right-end", "bottom-start", "bottom", "bottom-end"). |
hoisting | Boolean value: Tooltips will be clipped if they’re inside a container that has overflow: auto|hidden|scroll. The hoist attribute forces the tooltip to use a fixed positioning strategy, allowing it to break out of the container. |
style |
--max-width The maximum width of the tooltip before its content will wrap. --hide-delay The amount of time to wait before hiding the tooltip when hovering. --show-delay The amount of time to wait before showing the tooltip when hovering. --sl-tooltip-arrow-size: 0; You can control the size of tooltip arrows by overriding the --sl-tooltip-arrow-size design token. To remove them, set the value to 0 as shown below. |
Events (Coming soon)
eventName | Description of event |
Tree
Trees allow you to display a hierarchical list of selectable tree items. Items with children can be expanded and collapsed as desired by the user.
Attributes (tree)
theme | dark or light. |
selection | The selection behavior of the tree. Single selection allows only one node to be selected at a time. Multiple displays checkboxes and allows more than one node to be selected. Leaf allows only leaf nodes to be selected. |
style |
--indent-size The size of the indentation for nested items. --indent-guide-color The color of the indentation line. --indent-guide-offset The amount of vertical spacing to leave between the top and bottom of the indentation line’s starting position. --indent-guide-style The style of the indentation line, e.g. solid, dotted, dashed. solid --indent-guide-width The width of the indentation line. |
Attributes (tree-item)
selected | Boolean value. Draws the tree item in a selected state. |
expanded | Boolean value. Expands the tree item. |
disabled | Boolean value. Disables the tree item. |
lazy | Boolean value. Enables lazy loading behavior. |
Events
sl-selection-change | Emitted when a tree item is selected. The output is the tree-item label. |
Style variables
style-variable-name | Description of style variable |
Actions
-
Action A
Description...
Arguments
argumentName Description of argument
Formulas
-
Formula A
Description...
Arguments
argumentName Description of argument