{% extends "default.njk" %} {# Find the component based on the `tag` front matter #} {% set component = getComponent('sl-' + page.fileSlug) %} {% block content %} {# Determine the badge variant #} {% if component.status == 'stable' %} {% set badgeVariant = 'primary' %} {% elseif component.status == 'experimental' %} {% set badgeVariant = 'warning' %} {% elseif component.status == 'planned' %} {% set badgeVariant = 'neutral' %} {% elseif component.status == 'deprecated' %} {% set badgeVariant = 'danger' %} {% else %} {% set badgeVariant = 'neutral' %} {% endif %} {# Header #}

{{ component.name | classNameToComponentName }}

<{{ component.tagName }}> | {{ component.name }}
Since {{component.since or '?' }} {{ component.status }}

{% if component.summary %} {{ component.summary | markdownInline | safe }} {% endif %}

{# Markdown content #} {{ content | safe }} {# Importing #}

Importing

If you're using the autoloader or the traditional loader, you can ignore this section. Otherwise, feel free to use any of the following snippets to cherry pick this component.

Script Import Bundler React

To import this component from the CDN using a script tag:

<script type="module" src="https://cdn.jsdelivr.net/npm/@shoelace-style/shoelace@{{ meta.version }}/{{ meta.cdndir }}/{{ component.path }}"></script>

To import this component from the CDN using a JavaScript import:

import 'https://cdn.jsdelivr.net/npm/@shoelace-style/shoelace@{{ meta.version }}/{{ meta.cdndir }}/{{ component.path }}';

To import this component using a bundler:

import '@shoelace-style/shoelace/{{ meta.npmdir }}/{{ component.path }}';

To import this component as a React component:

import {{ component.name }} from '@shoelace-style/shoelace/{{ meta.npmdir }}/react/{{ component.tagNameWithoutPrefix }}';
{# Slots #} {% if component.slots.length %}

Slots

{% for slot in component.slots %} {% endfor %}
Name Description
{% if slot.name %} {{ slot.name }} {% else %} (default) {% endif %} {{ slot.description | markdownInline | safe }}

Learn more about using slots.

{% endif %} {# Properties #} {% if component.properties.length %}

Properties

{% for prop in component.properties %} {% endfor %}
Name Description Reflects Type Default
{{ prop.name }} {% if prop.attribute | length > 0 %} {% if prop.attribute != prop.name %}
{{ prop.attribute }} {% endif %} {% endif %}
{{ prop.description | markdownInline | safe }} {% if prop.reflects %} {% endif %} {% if prop.type.text %} {{ prop.type.text | trimPipes | markdownInline | safe }} {% else %} - {% endif %} {% if prop.default %} {{ prop.default | markdownInline | safe }} {% else %} - {% endif %}
updateComplete A read-only promise that resolves when the component has finished updating.

Learn more about attributes and properties.

{% endif %} {# Events #} {% if component.events.length %}

Events

{% for event in component.events %} {% endfor %}
Name React Event Description Event Detail
{{ event.name }} {{ event.reactName }} {{ event.description | markdownInline | safe }} {% if event.type.text %} {{ event.type.text | trimPipes }} {% else %} - {% endif %}

Learn more about events.

{% endif %} {# Methods #} {% if component.methods.length %}

Methods

{% for method in component.methods %} {% endfor %}
Name Description Arguments
{{ method.name }}() {{ method.description | markdownInline | safe }} {% if method.parameters.length %} {% for param in method.parameters %} {{ param.name }}: {{ param.type.text | trimPipes }}{% if not loop.last %},{% endif %} {% endfor %} {% else %} - {% endif %}

Learn more about methods.

{% endif %} {# Custom Properties #} {% if component.cssProperties.length %}

Custom Properties

{% for cssProperty in component.cssProperties %} {% endfor %}
Name Description Default
{{ cssProperty.name }} {{ cssProperty.description | markdownInline | safe }} {{ cssProperty.default }}

Learn more about customizing CSS custom properties.

{% endif %} {# CSS Parts #} {% if component.cssParts.length %}

Parts

{% for cssPart in component.cssParts %} {% endfor %}
Name Description
{{ cssPart.name }} {{ cssPart.description | markdownInline | safe }}

Learn more about customizing CSS parts.

{% endif %} {# Animations #} {% if component.animations.length %}

Animations

{% for animation in component.animations %} {% endfor %}
Name Description
{{ animation.name }} {{ animation.description | markdownInline | safe }}

Learn more about customizing animations.

{% endif %} {# Dependencies #} {% if component.dependencies.length %}

Dependencies

This component automatically imports the following dependencies.

{% endif %} {% endblock %}