Show More
The workspace migration is scheduled for Tuesday at 09:00 UTC. Your projects, comments, and uploaded files will move together. Read-only access remains available during the transfer.
Before the migration, export any reports needed for the morning meeting. Scheduled jobs will pause for up to fifteen minutes and resume after the new workspace passes its health checks.
If a check fails, the team will restore the previous workspace and notify its owners. Existing links will continue to work after the transfer.
Installation
npx @mielui/svelte add show-moreyarn dlx @mielui/svelte add show-morebunx @mielui/svelte add show-moreUsage
By default the content is clipped to lines lines, 3 by default, and the button appears only when the content is longer. Expanded content taller than maxHeight, 320 by default, scrolls inside a region named by label. Bind expanded when another control needs to coordinate the state.
<script lang="ts">
import { ShowMore } from '@mielui/svelte/components/show-more';
let { notes }: { notes: string } = $props();
let expanded = $state(false);
</script>
<ShowMore bind:expanded lines={3} labels={{ region: 'Release notes' }}>
<p>{notes}</p>
</ShowMore>Use the clipped view for prose. When hidden content includes links, forms, or buttons, pass a separate preview snippet: the full children stay mounted but hidden and inert while collapsed, so a clipped control never becomes an invisible keyboard stop. A trigger snippet replaces the default button; forward its props to a native button or Button.
Examples
Interactive details
preview, the full content, and trigger are separate snippets. This example replaces the default control. If controlled state collapses the details while focus is inside, focus returns to the trigger.
Project details include the setup guide and support contact.
Use the setup guide to configure your workspace, then contact support if you need help.
Capped content
Expanded content taller than maxHeight becomes a keyboard-focusable scroll region.
09:00 โ Paused scheduled reports and confirmed the latest backup.
09:03 โ Copied project records into the new workspace.
09:06 โ Verified uploaded files against their stored checksums.
09:08 โ Restored team roles and notification preferences.
09:11 โ Ran a sample export and checked the downloaded report.
09:14 โ Resumed scheduled jobs. Workspace owners can continue editing.
Button text
labels.more and labels.less name what is hidden. onExpandedChange runs with the new state each time the content expands or collapses.
Maya: The new limiter looks right to me.
Theo: Can we log the key when a client is throttled?
Amira: Docs need the retry header explained.
Jordan: Approved once the log line is in.
Maya: Log line added in the last commit.
Toggled 0 times
State and labels
The content starts collapsed. defaultExpanded starts it open when you are not binding expanded. onExpandedChange runs with the new state each time it expands or collapses.
Pass labels to set the built-in text. labels.more and labels.less are the button text in each state, Show more and Show less by default. Name what is hidden when you can, such as Show all 12 comments. labels.region names the expanded scroll region, Details by default. Every key is optional and English is the fallback.
API reference
ShowMore
Clamps long content and expands it on demand.
labelsShowMoreLabelsOverrides the built-in text and accessible names. Every key is optional and English is the fallback.
linesnumberNumber of visible text lines while collapsed.
Default
3maxHeightnumberMaximum expanded height before the content becomes scrollable.
Default
320defaultExpandedbooleanInitial expanded state when
expandedis not bound.Default
falseexpandedBindablebooleanBindable disclosure state.
Default
defaultExpandedonExpandedChange((expanded: boolean) => void)Called with the new state when it expands or collapses.
childrenSnippet<[]>Full content. With preview, this subtree is hidden and inert while collapsed. Content rendered inside.
previewSnippet<[]>Separate collapsed content for disclosures containing interactive controls.
triggerSnippet<[{ expanded: boolean; props: Pick<HTMLButtonAttributes, "id" | "aria-controls" | "aria-expanded" | "onclick" | "type">; }]>Custom control. Forward props to its native button to preserve disclosure semantics.
classstringClasses added to the element.
pnpm dlx @mielui/svelte add show-more