-
+
Option 1
Option 2
Option 3
@@ -173,6 +313,31 @@ The `value` property is bound to the current selection. As the selection changes
```
+```jsx react
+import { useState } from 'react';
+import { SlButton, SlMenuItem, SlSelect } from '@shoelace-style/shoelace/dist/react';
+
+const App = () => {
+ const [value, setValue] = useState('option-1');
+
+ return (
+ <>
+ setValue(event.target.value)}>
+ Option 1
+ Option 2
+ Option 3
+
+
+
+
+ setValue('option-1')}>Set 1
+ setValue('option-2')}>Set 2
+ setValue('option-3')}>Set 3
+ >
+ );
+};
+```
+
### Labels
Use the `label` attribute to give the select an accessible label. For labels that contain HTML, use the `label` slot instead.
@@ -185,6 +350,18 @@ Use the `label` attribute to give the select an accessible label. For labels tha
```
+```jsx react
+import { SlMenuItem, SlSelect } from '@shoelace-style/shoelace/dist/react';
+
+const App = () => (
+
+ Option 1
+ Option 2
+ Option 3
+
+);
+```
+
### Help Text
Add descriptive help text to a select with the `help-text` attribute. For help texts that contain HTML, use the `help-text` slot instead.
@@ -194,12 +371,27 @@ Add descriptive help text to a select with the `help-text` attribute. For help t
label="Experience"
help-text="Please tell us your skill level."
>
- Novice
- Intermediate
- Advanced
+ Novice
+ Intermediate
+ Advanced
```
+```jsx react
+import { SlMenuItem, SlSelect } from '@shoelace-style/shoelace/dist/react';
+
+const App = () => (
+
+ Novice
+ Intermediate
+ Advanced
+
+);
+```
+
### Prefix & Suffix Icons
Use the `prefix` and `suffix` slots to add icons.
@@ -230,4 +422,36 @@ Use the `prefix` and `suffix` slots to add icons.
```
+```jsx react
+import { SlIcon, SlMenuItem, SlSelect } from '@shoelace-style/shoelace/dist/react';
+
+const App = () => (
+ <>
+
+
+ Option 1
+ Option 2
+ Option 3
+
+
+
+
+
+ Option 1
+ Option 2
+ Option 3
+
+
+
+
+
+ Option 1
+ Option 2
+ Option 3
+
+
+ >
+);
+```
+
[component-metadata:sl-select]
diff --git a/docs/components/skeleton.md b/docs/components/skeleton.md
index 9878866ee..19f4f56c9 100644
--- a/docs/components/skeleton.md
+++ b/docs/components/skeleton.md
@@ -54,6 +54,60 @@ Skeletons try not to be opinionated, as there are endless possibilities for desi
```
+```jsx react
+import { SlSkeleton } from '@shoelace-style/shoelace/dist/react';
+
+const css = `
+ .skeleton-overview header {
+ display: flex;
+ align-items: center;
+ margin-bottom: 1rem;
+ }
+
+ .skeleton-overview header sl-skeleton:last-child {
+ flex: 0 0 auto;
+ width: 30%;
+ }
+
+ .skeleton-overview sl-skeleton {
+ margin-bottom: 1rem;
+ }
+
+ .skeleton-overview sl-skeleton:nth-child(1) {
+ float: left;
+ width: 3rem;
+ height: 3rem;
+ margin-right: 1rem;
+ vertical-align: middle;
+ }
+
+ .skeleton-overview sl-skeleton:nth-child(3) {
+ width: 95%;
+ }
+
+ .skeleton-overview sl-skeleton:nth-child(4) {
+ width: 80%;
+ }
+`;
+
+const App = () => (
+ <>
+
+
+
+
+
+
+
+
+
+ >
+);
+```
+
## Examples
### Effects
@@ -83,6 +137,37 @@ There are two built-in effects, `sheen` and `pulse`. Effects are intentionally s
```
+```jsx react
+import { SlSkeleton } from '@shoelace-style/shoelace/dist/react';
+
+const css = `
+ .skeleton-effects {
+ font-size: var(--sl-font-size-small);
+ }
+
+ .skeleton-effects sl-skeleton:not(:first-child) {
+ margin-top: 1rem;
+ }
+`;
+
+const App = () => (
+ <>
+
+
+ None
+
+
+ Sheen
+
+
+ Pulse
+
+
+
+ >
+);
+```
+
### Paragraphs
Use multiple skeletons and some clever styles to simulate paragraphs.
@@ -115,6 +200,42 @@ Use multiple skeletons and some clever styles to simulate paragraphs.
```
+```jsx react
+import { SlSkeleton } from '@shoelace-style/shoelace/dist/react';
+
+const css = `
+ .skeleton-paragraphs sl-skeleton {
+ margin-bottom: 1rem;
+ }
+
+ .skeleton-paragraphs sl-skeleton:nth-child(2) {
+ width: 95%;
+ }
+
+ .skeleton-paragraphs sl-skeleton:nth-child(4) {
+ width: 90%;
+ }
+
+ .skeleton-paragraphs sl-skeleton:last-child {
+ width: 50%;
+ }
+`;
+
+const App = () => (
+ <>
+
+
+
+
+
+
+
+
+
+ >
+);
+```
+
### Avatars
Set a matching width and height to make a circle, square, or rounded avatar skeleton.
@@ -144,6 +265,39 @@ Set a matching width and height to make a circle, square, or rounded avatar skel
```
+```jsx react
+import { SlSkeleton } from '@shoelace-style/shoelace/dist/react';
+
+const css = `
+ .skeleton-avatars sl-skeleton {
+ display: inline-block;
+ width: 3rem;
+ height: 3rem;
+ margin-right: .5rem;
+ }
+
+ .skeleton-avatars sl-skeleton:nth-child(1) {
+ --border-radius: 0;
+ }
+
+ .skeleton-avatars sl-skeleton:nth-child(2) {
+ --border-radius: var(--sl-border-radius-medium);
+ }
+`;
+
+const App = () => (
+ <>
+
+
+
+
+
+
+
+ >
+);
+```
+
### Custom Shapes
Use the `--border-radius` custom property to make circles, squares, and rectangles. For more complex shapes, you can apply `clip-path` to the `indicator` part. [Try Clippy](https://bennettfeely.com/clippy/) if you need help generating custom shapes.
@@ -193,6 +347,59 @@ Use the `--border-radius` custom property to make circles, squares, and rectangl
```
+```jsx react
+import { SlSkeleton } from '@shoelace-style/shoelace/dist/react';
+
+const css = `
+ .skeleton-shapes sl-skeleton {
+ display: inline-flex;
+ width: 50px;
+ height: 50px;
+ }
+
+ .skeleton-shapes .square::part(indicator) {
+ --border-radius: var(--sl-border-radius-medium);
+ }
+
+ .skeleton-shapes .circle::part(indicator) {
+ --border-radius: var(--sl-border-radius-circle);
+ }
+
+ .skeleton-shapes .triangle::part(indicator) {
+ --border-radius: 0;
+ clip-path: polygon(50% 0, 0 100%, 100% 100%);
+ }
+
+ .skeleton-shapes .cross::part(indicator) {
+ --border-radius: 0;
+ clip-path: polygon(20% 0%, 0% 20%, 30% 50%, 0% 80%, 20% 100%, 50% 70%, 80% 100%, 100% 80%, 70% 50%, 100% 20%, 80% 0%, 50% 30%);
+ }
+
+ .skeleton-shapes .comment::part(indicator) {
+ --border-radius: 0;
+ clip-path: polygon(0% 0%, 100% 0%, 100% 75%, 75% 75%, 75% 100%, 50% 75%, 0% 75%);
+ }
+
+ .skeleton-shapes sl-skeleton:not(:last-child) {
+ margin-right: .5rem;
+ }
+`;
+
+const App = () => (
+ <>
+
+
+
+
+
+
+
+
+
+ >
+);
+```
+
### Custom Colors
Set the `--color` and `--sheen-color` custom properties to adjust the skeleton's color.
@@ -201,4 +408,32 @@ Set the `--color` and `--sheen-color` custom properties to adjust the skeleton's
```
+```jsx react
+import { SlSkeleton } from '@shoelace-style/shoelace/dist/react';
+
+const css = `
+ .skeleton-avatars sl-skeleton {
+ display: inline-block;
+ width: 3rem;
+ height: 3rem;
+ margin-right: .5rem;
+ }
+
+ .skeleton-avatars sl-skeleton:nth-child(1) {
+ --border-radius: 0;
+ }
+
+ .skeleton-avatars sl-skeleton:nth-child(2) {
+ --border-radius: var(--sl-border-radius-medium);
+ }
+`;
+
+const App = () => (
+
+);
+```
+
[component-metadata:sl-skeleton]
diff --git a/docs/components/spinner.md b/docs/components/spinner.md
index ba0f3a5bd..d99a050b1 100644
--- a/docs/components/spinner.md
+++ b/docs/components/spinner.md
@@ -8,6 +8,14 @@ Spinners are used to show the progress of an indeterminate operation.
```
+```jsx react
+import { SlSpinner } from '@shoelace-style/shoelace/dist/react';
+
+const App = () => (
+
+);
+```
+
## Examples
### Size
@@ -20,6 +28,18 @@ Spinners are sized based on the current font size. To change their size, set the
```
+```jsx react
+import { SlSpinner } from '@shoelace-style/shoelace/dist/react';
+
+const App = () => (
+ <>
+
+
+
+ >
+);
+```
+
### Track Width
The width of the spinner's track can be changed by setting the `--track-width` custom property.
@@ -28,6 +48,19 @@ The width of the spinner's track can be changed by setting the `--track-width` c
```
+```jsx react
+import { SlSpinner } from '@shoelace-style/shoelace/dist/react';
+
+const App = () => (
+
+);
+```
+
### Color
The spinner's colors can be changed by setting the `--indicator-color` and `--track-color` custom properties.
@@ -36,4 +69,18 @@ The spinner's colors can be changed by setting the `--indicator-color` and `--tr
```
+```jsx react
+import { SlSpinner } from '@shoelace-style/shoelace/dist/react';
+
+const App = () => (
+
+);
+```
+
[component-metadata:sl-spinner]
diff --git a/docs/components/switch.md b/docs/components/switch.md
index 06a628b7a..1570318e4 100644
--- a/docs/components/switch.md
+++ b/docs/components/switch.md
@@ -8,6 +8,14 @@ Switches allow the user to toggle an option on or off.
Switch
```
+```jsx react
+import { SlSwitch } from '@shoelace-style/shoelace/dist/react';
+
+const App = () => (
+
Switch
+);
+```
+
?> This component doesn't work with standard forms. Use [`
`](/components/form) instead.
## Examples
@@ -20,6 +28,14 @@ Use the `checked` attribute to activate the switch.
Checked
```
+```jsx react
+import { SlSwitch } from '@shoelace-style/shoelace/dist/react';
+
+const App = () => (
+ Checked
+);
+```
+
### Disabled
Use the `disabled` attribute to disable the switch.
@@ -28,6 +44,14 @@ Use the `disabled` attribute to disable the switch.
Disabled
```
+```jsx react
+import { SlSwitch } from '@shoelace-style/shoelace/dist/react';
+
+const App = () => (
+ Disabled
+);
+```
+
### Custom Size
Use the available custom properties to make the switch a different size.
@@ -36,4 +60,18 @@ Use the available custom properties to make the switch a different size.
```
+```jsx react
+import { SlSwitch } from '@shoelace-style/shoelace/dist/react';
+
+const App = () => (
+
+);
+```
+
[component-metadata:sl-switch]
diff --git a/docs/components/tab-group.md b/docs/components/tab-group.md
index 11cd4089f..8b489c632 100644
--- a/docs/components/tab-group.md
+++ b/docs/components/tab-group.md
@@ -20,6 +20,24 @@ Tab groups make use of [tabs](/components/tab) and [tab panels](/components/tab-
```
+```jsx react
+import { SlTab, SlTabGroup, SlTabPanel } from '@shoelace-style/shoelace/dist/react';
+
+const App = () => (
+
+ General
+ Custom
+ Advanced
+ Disabled
+
+ This is the general tab panel.
+ This is the custom tab panel.
+ This is the advanced tab panel.
+ This is a disabled tab panel.
+
+);
+```
+
## Examples
### Tabs on Bottom
@@ -40,6 +58,24 @@ Tabs can be shown on the bottom by setting `placement` to `bottom`.
```
+```jsx react
+import { SlTab, SlTabGroup, SlTabPanel } from '@shoelace-style/shoelace/dist/react';
+
+const App = () => (
+
+ General
+ Custom
+ Advanced
+ Disabled
+
+ This is the general tab panel.
+ This is the custom tab panel.
+ This is the advanced tab panel.
+ This is a disabled tab panel.
+
+);
+```
+
### Tabs on Start
Tabs can be shown on the starting side by setting `placement` to `start`.
@@ -58,6 +94,25 @@ Tabs can be shown on the starting side by setting `placement` to `start`.
```
+
+```jsx react
+import { SlTab, SlTabGroup, SlTabPanel } from '@shoelace-style/shoelace/dist/react';
+
+const App = () => (
+
+ General
+ Custom
+ Advanced
+ Disabled
+
+ This is the general tab panel.
+ This is the custom tab panel.
+ This is the advanced tab panel.
+ This is a disabled tab panel.
+
+);
+```
+
### Tabs on End
Tabs can be shown on the ending side by setting `placement` to `end`.
@@ -76,6 +131,25 @@ Tabs can be shown on the ending side by setting `placement` to `end`.
```
+
+```jsx react
+import { SlTab, SlTabGroup, SlTabPanel } from '@shoelace-style/shoelace/dist/react';
+
+const App = () => (
+
+ General
+ Custom
+ Advanced
+ Disabled
+
+ This is the general tab panel.
+ This is the custom tab panel.
+ This is the advanced tab panel.
+ This is a disabled tab panel.
+
+);
+```
+
### Closable Tabs
Add the `closable` attribute to a tab to show a close button. This example shows how you can dynamically remove tabs from the DOM when the close button is activated.
@@ -112,6 +186,40 @@ Add the `closable` attribute to a tab to show a close button. This example shows
```
+```jsx react
+import { SlTab, SlTabGroup, SlTabPanel } from '@shoelace-style/shoelace/dist/react';
+
+const App = () => {
+ function handleClose(event) {
+ //
+ // This is a crude example that removes the tab and its panel from the DOM.
+ // There are better ways to manage tab creation/removal in React, but that
+ // would significantly complicate the example.
+ //
+ const tab = event.target;
+ const tabGroup = tab.closest('sl-tab-group');
+ const tabPanel = tabGroup.querySelector(`[aria-labelledby="${tab.id}"]`);
+
+ tab.remove();
+ tabPanel.remove();
+ }
+
+ return (
+
+ General
+ Closable 1
+ Closable 2
+ Closable 3
+
+ This is the general tab panel.
+ This is the first closable tab panel.
+ This is the second closable tab panel.
+ This is the third closable tab panel.
+
+ );
+};
+```
+
### Scrolling Tabs
When there are more tabs than horizontal space allows, the nav will be scrollable.
@@ -162,6 +270,56 @@ When there are more tabs than horizontal space allows, the nav will be scrollabl
```
+```jsx react
+import { SlTab, SlTabGroup, SlTabPanel } from '@shoelace-style/shoelace/dist/react';
+
+const App = () => (
+
+ Tab 1
+ Tab 2
+ Tab 3
+ Tab 4
+ Tab 5
+ Tab 6
+ Tab 7
+ Tab 8
+ Tab 9
+ Tab 10
+ Tab 11
+ Tab 12
+ Tab 13
+ Tab 14
+ Tab 15
+ Tab 16
+ Tab 17
+ Tab 18
+ Tab 19
+ Tab 20
+
+ Tab panel 1
+ Tab panel 2
+ Tab panel 3
+ Tab panel 4
+ Tab panel 5
+ Tab panel 6
+ Tab panel 7
+ Tab panel 8
+ Tab panel 9
+ Tab panel 10
+ Tab panel 11
+ Tab panel 12
+ Tab panel 13
+ Tab panel 14
+ Tab panel 15
+ Tab panel 16
+ Tab panel 17
+ Tab panel 18
+ Tab panel 19
+ Tab panel 20
+
+);
+```
+
### Manual Activation
When focused, keyboard users can press Left or Right to select the desired tab. By default, the corresponding tab panel will be shown immediately (automatic activation). You can change this behavior by setting `activation="manual"` which will require the user to press Space or Enter before showing the tab panel (manual activation).
@@ -180,4 +338,22 @@ When focused, keyboard users can press Left or Right to se
```
+```jsx react
+import { SlTab, SlTabGroup, SlTabPanel } from '@shoelace-style/shoelace/dist/react';
+
+const App = () => (
+
+ General
+ Custom
+ Advanced
+ Disabled
+
+ This is the general tab panel.
+ This is the custom tab panel.
+ This is the advanced tab panel.
+ This is a disabled tab panel.
+
+);
+```
+
[component-metadata:sl-tab-group]
diff --git a/docs/components/tab-panel.md b/docs/components/tab-panel.md
index 10d94f551..34ad4c480 100644
--- a/docs/components/tab-panel.md
+++ b/docs/components/tab-panel.md
@@ -18,6 +18,24 @@ Tab panels are used inside [tab groups](/components/tab-group) to display tabbed
```
+```jsx react
+import { SlTab, SlTabGroup, SlTabPanel } from '@shoelace-style/shoelace/dist/react';
+
+const App = () => (
+
+ General
+ Custom
+ Advanced
+ Disabled
+
+ This is the general tab panel.
+ This is the custom tab panel.
+ This is the advanced tab panel.
+ This is a disabled tab panel.
+
+);
+```
+
?> Additional demonstrations can be found in the [tab group examples](/components/tab-group).
[component-metadata:sl-tab-panel]
diff --git a/docs/components/tab.md b/docs/components/tab.md
index ca9ddc260..2ff680dc3 100644
--- a/docs/components/tab.md
+++ b/docs/components/tab.md
@@ -11,6 +11,19 @@ Tabs are used inside [tab groups](/components/tab-group) to represent and activa
Disabled
```
+```jsx react
+import { SlTab } from '@shoelace-style/shoelace/dist/react';
+
+const App = () => (
+ <>
+ Tab
+ Active
+ Closable
+ Disabled
+ >
+);
+```
+
?> Additional demonstrations can be found in the [tab group examples](/components/tab-group).
[component-metadata:sl-tab]
diff --git a/docs/components/tag.md b/docs/components/tag.md
index 6a7ab9d87..65f5cc5ac 100644
--- a/docs/components/tag.md
+++ b/docs/components/tag.md
@@ -12,6 +12,21 @@ Tags are used as labels to organize things or to indicate a selection.
Danger
```
+
+```jsx react
+import { SlTag } from '@shoelace-style/shoelace/dist/react';
+
+const App = () => (
+ <>
+ Primary
+ Success
+ Neutral
+ Warning
+ Danger
+ >
+);
+```
+
## Examples
### Sizes
@@ -24,6 +39,18 @@ Use the `size` attribute to change a tab's size.
Large
```
+```jsx react
+import { SlTag } from '@shoelace-style/shoelace/dist/react';
+
+const App = () => (
+ <>
+ Small
+ Medium
+ Large
+ >
+);
+```
+
### Pill
Use the `pill` attribute to give tabs rounded edges.
@@ -34,6 +61,18 @@ Use the `pill` attribute to give tabs rounded edges.
Large
```
+```jsx react
+import { SlTag } from '@shoelace-style/shoelace/dist/react';
+
+const App = () => (
+ <>
+ Small
+ Medium
+ Large
+ >
+);
+```
+
### Removable
Use the `removable` attribute to add a remove button to the tag.
@@ -62,4 +101,42 @@ Use the `removable` attribute to add a remove button to the tag.
```
+```jsx react
+import { SlTag } from '@shoelace-style/shoelace/dist/react';
+
+const css = `
+ .tags-removable sl-tag {
+ transition: var(--sl-transition-medium) opacity;
+ }
+`;
+
+const App = () => {
+ function handleRemove(event) {
+ const tag = event.target;
+ tag.style.opacity = '0';
+ setTimeout(() => tag.style.opacity = '1', 2000);
+ }
+
+ return (
+ <>
+
+
+ Small
+
+
+
+ Medium
+
+
+
+ Large
+
+
+
+
+ >
+ )
+};
+```
+
[component-metadata:sl-tag]
diff --git a/docs/components/textarea.md b/docs/components/textarea.md
index 6ebbb76ee..1956dc728 100644
--- a/docs/components/textarea.md
+++ b/docs/components/textarea.md
@@ -8,6 +8,14 @@ Textareas collect data from the user and allow multiple lines of text.
```
+```jsx react
+import { SlTextarea } from '@shoelace-style/shoelace/dist/react';
+
+const App = () => (
+
+);
+```
+
?> This component doesn't work with standard forms. Use [``](/components/form) instead.
?> Please refer to the section on [form control validation](/components/form?id=form-control-validation) to learn how to do client-side validation.
@@ -22,6 +30,14 @@ Use the `rows` attribute to change the number of text rows that get shown.
```
+```jsx react
+import { SlTextarea } from '@shoelace-style/shoelace/dist/react';
+
+const App = () => (
+
+);
+```
+
### Placeholders
Use the `placeholder` attribute to add a placeholder.
@@ -30,6 +46,14 @@ Use the `placeholder` attribute to add a placeholder.
```
+```jsx react
+import { SlTextarea } from '@shoelace-style/shoelace/dist/react';
+
+const App = () => (
+
+);
+```
+
### Filled Textareas
Add the `filled` attribute to draw a filled textarea.
@@ -38,6 +62,14 @@ Add the `filled` attribute to draw a filled textarea.
```
+```jsx react
+import { SlTextarea } from '@shoelace-style/shoelace/dist/react';
+
+const App = () => (
+
+);
+```
+
### Disabled
Use the `disabled` attribute to disable a textarea.
@@ -46,6 +78,14 @@ Use the `disabled` attribute to disable a textarea.
```
+```jsx react
+import { SlTextarea } from '@shoelace-style/shoelace/dist/react';
+
+const App = () => (
+
+);
+```
+
### Sizes
Use the `size` attribute to change a textarea's size.
@@ -58,6 +98,20 @@ Use the `size` attribute to change a textarea's size.
```
+```jsx react
+import { SlTextarea } from '@shoelace-style/shoelace/dist/react';
+
+const App = () => (
+ <>
+
+
+
+
+
+ >
+);
+```
+
### Labels
Use the `label` attribute to give the textarea an accessible label. For labels that contain HTML, use the `label` slot instead.
@@ -66,6 +120,14 @@ Use the `label` attribute to give the textarea an accessible label. For labels t
```
+```jsx react
+import { SlTextarea } from '@shoelace-style/shoelace/dist/react';
+
+const App = () => (
+
+);
+```
+
### Help Text
Add descriptive help text to a textarea with the `help-text` attribute. For help texts that contain HTML, use the `help-text` slot instead.
@@ -78,6 +140,17 @@ Add descriptive help text to a textarea with the `help-text` attribute. For help
```
+```jsx react
+import { SlTextarea } from '@shoelace-style/shoelace/dist/react';
+
+const App = () => (
+
+);
+```
+
### Prevent Resizing
By default, textareas can be resized vertically by the user. To prevent resizing, set the `resize` attribute to `none`.
@@ -86,6 +159,14 @@ By default, textareas can be resized vertically by the user. To prevent resizing
```
+```jsx react
+import { SlTextarea } from '@shoelace-style/shoelace/dist/react';
+
+const App = () => (
+
+);
+```
+
### Expand with Content
Textareas will automatically resize to expand to fit their content when `resize` is set to `auto`.
@@ -94,4 +175,12 @@ Textareas will automatically resize to expand to fit their content when `resize`
```
+```jsx react
+import { SlTextarea } from '@shoelace-style/shoelace/dist/react';
+
+const App = () => (
+
+);
+```
+
[component-metadata:sl-textarea]
diff --git a/docs/components/tooltip.md b/docs/components/tooltip.md
index c2ecc0401..5c26129dc 100644
--- a/docs/components/tooltip.md
+++ b/docs/components/tooltip.md
@@ -14,6 +14,16 @@ Tooltips use `display: contents` so they won't interfere with how elements are p
```
+```jsx react
+import { SlButton, SlTooltip } from '@shoelace-style/shoelace/dist/react';
+
+const App = () => (
+
+ Hover Me
+
+);
+```
+
## Examples
### Placement
@@ -41,7 +51,7 @@ Use the `placement` attribute to set the preferred placement of the tooltip.
-
+
@@ -99,17 +109,119 @@ Use the `placement` attribute to set the preferred placement of the tooltip.
margin-bottom: 0.25rem;
}
- .tooltip-placement-example [placement='top-start'] sl-button,
- .tooltip-placement-example [placement='bottom-start'] sl-button {
+ .tooltip-placement-example-row:nth-child(1) sl-tooltip:first-child sl-button,
+ .tooltip-placement-example-row:nth-child(5) sl-tooltip:first-child sl-button {
margin-left: calc(40px + 0.25rem);
}
- .tooltip-placement-example [placement^='right'] sl-button {
+ .tooltip-placement-example-row:nth-child(2) sl-tooltip:nth-child(2) sl-button,
+ .tooltip-placement-example-row:nth-child(3) sl-tooltip:nth-child(2) sl-button,
+ .tooltip-placement-example-row:nth-child(4) sl-tooltip:nth-child(2) sl-button {
margin-left: calc((40px * 3) + (0.25rem * 3));
}
```
+```jsx react
+import { SlButton, SlTooltip } from '@shoelace-style/shoelace/dist/react';
+
+const css = `
+ .tooltip-placement-example {
+ width: 250px;
+ }
+
+ .tooltip-placement-example-row:after {
+ content: '';
+ display: table;
+ clear: both;
+ }
+
+ .tooltip-placement-example sl-button {
+ float: left;
+ width: 2.5rem;
+ margin-right: 0.25rem;
+ margin-bottom: 0.25rem;
+ }
+
+ .tooltip-placement-example-row:nth-child(1) sl-tooltip:first-child sl-button,
+ .tooltip-placement-example-row:nth-child(5) sl-tooltip:first-child sl-button {
+ margin-left: calc(40px + 0.25rem);
+ }
+
+ .tooltip-placement-example-row:nth-child(2) sl-tooltip:nth-child(2) sl-button,
+ .tooltip-placement-example-row:nth-child(3) sl-tooltip:nth-child(2) sl-button,
+ .tooltip-placement-example-row:nth-child(4) sl-tooltip:nth-child(2) sl-button {
+ margin-left: calc((40px * 3) + (0.25rem * 3));
+ }
+`;
+
+const App = () => (
+ <>
+