Snap Drawer
Install the component, then paste your configured usage. Your settings are included in the code below.
npx arclen-ui add snap-drawer --settings eyJ0cmlnZ2VyTGFiZWwiOiJRdWljayB2aWV3IiwidGl0bGUiOiJBcmMgZGVzayBsYW1wIiwibWV0YWRhdGEiOiIkMTI4IFVTRCDCtyBJbiBzdG9jayIsImRlc2NyaXB0aW9uIjoiV2FybSwgZGltbWFibGUgbGlnaHQgZm9yIGEgcXVpZXRlciBkZXNrLlxuU2VsZWN0ZWQ6IEdyYXBoaXRlIMK3IFVTQi1DIiwic2hvd0ltYWdlIjp0cnVlLCJpbWFnZVVybCI6IiIsImltYWdlQWx0IjoiR3JhcGhpdGUgQXJjIGRlc2sgbGFtcCB3aXRoIGEgYmx1ZS1saXQgY3VydmVkIGVkZ2UgYW5kIHdhcm0gdW5kZXJzaWRlIG9uIGEgc2xhdGUgYmFja2dyb3VuZC4iLCJzaG93UmF0aW5nIjpmYWxzZSwicmF0aW5nIjo1LCJzaG93QWN0aW9uIjp0cnVlLCJhY3Rpb25MYWJlbCI6IkNob29zZSB0aGlzIGxhbXAiLCJhY3Rpb25IcmVmIjoiIiwiZ3JvdXBPbmVUaXRsZSI6IlNwZWNpZmljYXRpb25zIiwiZ3JvdXBPbmVUaXRsZXMiOlsiTGlnaHQiLCJNYXRlcmlhbHMiLCJTaXplICYgcG93ZXIiXSwiZ3JvdXBPbmVEZXNjcmlwdGlvbnMiOlsiMjcwMCBLIHdhcm0gd2hpdGUuIFRocmVlIGJyaWdodG5lc3MgbGV2ZWxzIHdpdGggYSB0b3VjaCBkaW1tZXIuIiwiUG93ZGVyLWNvYXRlZCBhbHVtaW51bSB3aXRoIGEgd2VpZ2h0ZWQgYmFzZSBhbmQgc29mdCB1bmRlcnNpZGUuIiwiMzIgY20gdGFsbCDCtyAxNCBjbSBiYXNlIMK3IDYgVyBMRUQuIEluY2x1ZGVzIGEgMS41IG0gVVNCLUMgY2FibGU7IHBvd2VyIGFkYXB0ZXIgc29sZCBzZXBhcmF0ZW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JoYW5kbGVIb3ZlckNvbG9yIjoiIzkzYzVmZCIsImhhbmRsZURyYWdDb2xvciI6IiNmNWZhZmYiLCJoYW5kbGVGZWVkYmFja0R1cmF0aW9uIjoxNTB9import { SnapDrawer } from "@/components/snap-drawer";
export default function Example() {
return <SnapDrawer {...{
"triggerLabel": "Quick view",
"title": "Arc desk lamp",
"metadata": "$128 USD · In stock",
"description": "Warm, dimmable light for a quieter desk.\nSelected: Graphite · USB-C",
"showImage": true,
"imageUrl": "",
"imageAlt": "Graphite Arc desk lamp with a blue-lit curved edge and warm underside on a slate background.",
"showRating": false,
"rating": 5,
"showAction": true,
"actionLabel": "Choose this lamp",
"actionHref": "",
"groupOneTitle": "Specifications",
"groupOneTitles": [
"Light",
"Materials",
"Size & power"
],
"groupOneDescriptions": [
"2700 K warm white. Three brightness levels with a touch dimmer.",
"Powder-coated aluminum with a weighted base and soft underside.",
"32 cm tall · 14 cm base · 6 W LED. Includes a 1.5 m USB-C cable; power adapter sold separately."
],
"showQuote": false,
"quote": "A small pool of light, exactly where you need it.",
"quoteAttribution": "Design note · Fictional product",
"groupTwoTitle": "Delivery & returns",
"groupTwoTitles": [
"Dispatch",
"Delivery",
"Returns"
],
"groupTwoDescriptions": [
"Ready to leave the studio in 2 business days.",
"Standard delivery in 3–5 business days after dispatch. Shipping calculated at checkout.",
"Return within 30 days in the original packaging. This is a fictional product demo; no order is placed."
],
"fontFamily": "geist",
"theme": "dark",
"contentWidth": 448,
"maxHeight": 97,
"contentPadding": 16,
"sectionGap": 48,
"radius": 10,
"shadow": "none",
"bodySize": 16,
"bodyLineHeight": 1.5,
"headingSize": 24,
"surfaceColor": "#171717",
"textColor": "#fafafa",
"mutedColor": "#a1a1aa",
"borderColor": "#3f3f46",
"actionColor": "#fafafa",
"actionTextColor": "#18181b",
"overlayColor": "#000000",
"overlayOpacity": 0.4,
"overlayMode": "adaptive",
"snapPoints": [
"148px",
"355px",
"100%"
],
"initialSnap": 0,
"dragEnabled": true,
"dismissOnOverlay": true,
"showHandle": true,
"duration": 500,
"easing": "glide",
"beamEnabled": true,
"beamPalette": "adaptive",
"beamColor1": "#003dff",
"beamColor2": "#0055ff",
"beamColor3": "#3366ff",
"beamColor4": "#0033ee",
"beamRestOpacity": 0,
"beamHoverOpacity": 0.9,
"beamDragOpacity": 1,
"beamDarkIntensity": 0.85,
"beamLineThickness": 1,
"beamCoreHighlight": 0.85,
"beamGlowThickness": 10,
"beamGlowBlur": 4,
"beamGlowOpacity": 0.7,
"beamDragGlowThickness": 14,
"beamDragGlowOpacity": 0.82,
"beamEndFade": 22,
"beamWidth": 100,
"beamActivationDistance": 12,
"beamFadeDuration": 180,
"beamEasing": "ease",
"handleFeedbackEnabled": true,
"handlePalette": "adaptive",
"handleHoverColor": "#93c5fd",
"handleDragColor": "#f5faff",
"handleFeedbackDuration": 150
}} />;
}| Property | Type | Default |
|---|---|---|
triggerLabelTrigger label Up to 80 characters | text | "Quick view" |
titleTitle Up to 120 characters | text | "Arc desk lamp" |
metadataMetadata Up to 180 characters | text | "$128 USD · In stock" |
descriptionIntroduction Up to 2000 characters | text | "Warm, dimmable light for a quieter desk.\nSelected: Graphite · USB-C" |
showImageShow image | boolean | true |
imageUrlImage URL Leave empty for the bundled lamp photograph. Hidden images are not requested. Up to 12000000 characters | image | "" |
imageAltImage alt text Describe your replacement image, or leave empty when decorative. Up to 300 characters | text | "Graphite Arc desk lamp with a blue-lit curved edge and warm underside on a slate background." |
showRatingShow rating | boolean | false |
ratingRating 0–5Step 1 | number | 5 |
showActionShow action | boolean | true |
actionLabelAction label Up to 80 characters | text | "Choose this lamp" |
actionHrefAction link Up to 2048 characters | text | "" |
groupOneTitleFirst group title Up to 120 characters | text | "Specifications" |
groupOneTitlesFirst group item titles Minimum 0 itemsMaximum 8 itemsUp to 300 characters per item | string-list | ["Light","Materials","Size & power"] |
groupOneDescriptionsFirst group item descriptions Minimum 0 itemsMaximum 8 itemsUp to 300 characters per item | string-list | ["2700 K warm white. Three brightness levels with a touch dimmer.","Powder-coated aluminum with a weighted base and soft underside.","32 cm tall · 14 cm base · 6 W LED. Includes a 1.5 m USB-C cable; power adapter sold separately."] |
showQuoteShow quotation | boolean | false |
quoteQuotation Up to 1000 characters | text | "A small pool of light, exactly where you need it." |
quoteAttributionQuote attribution Up to 160 characters | text | "Design note · Fictional product" |
groupTwoTitleSecond group title Up to 120 characters | text | "Delivery & returns" |
groupTwoTitlesSecond group item titles Minimum 0 itemsMaximum 8 itemsUp to 300 characters per item | string-list | ["Dispatch","Delivery","Returns"] |
groupTwoDescriptionsSecond group item descriptions Minimum 0 itemsMaximum 8 itemsUp to 300 characters per item | string-list | ["Ready to leave the studio in 2 business days.","Standard delivery in 3–5 business days after dispatch. Shipping calculated at checkout.","Return within 30 days in the original packaging. This is a fictional product demo; no order is placed."] |
fontFamilyFont Options: geist, system | select | "geist" |
themeColor mode Options: system, light, dark, custom | select | "system" |
contentWidthContent width 280–800Step 1 | number | 448 |
maxHeightMaximum height (%) 50–100Step 1 | number | 97 |
contentPaddingHorizontal padding 8–48Step 1 | number | 16 |
sectionGapSection gap 16–80Step 1 | number | 48 |
radiusTop corners 0–40Step 1 | number | 10 |
shadowShadow Options: none, soft, strong | select | "none" |
bodySizeBody size 14–22Step 1 | number | 16 |
bodyLineHeightBody line height 1.2–2Step 0.05 | number | 1.5 |
headingSizeTitle size 20–40Step 1 | number | 24 |
surfaceColorSurface | color | "#ffffff" |
textColorText | color | "#18181b" |
mutedColorSecondary text | color | "#52525b" |
borderColorBorder | color | "#e4e4e7" |
actionColorAction background | color | "#000000" |
actionTextColorAction text | color | "#fafafa" |
overlayColorOverlay | color | "#000000" |
overlayOpacityOverlay opacity 0–0.8Step 0.05 | number | 0.4 |
overlayModeOverlay behavior Adaptive follows direction-aware snap transitions; Constant keeps the configured dimming while open. Options: adaptive (Adaptive), constant (Constant) | select | "adaptive" |
snapPointsSnap points Viewport-relative snap anchors such as 148px or 100%; anchors are not visible drawer heights. Minimum 2 itemsMaximum 5 itemsUp to 12 characters per item | string-list | ["148px","355px","100%"] |
initialSnapInitial snap 0–4Step 1 | number | 0 |
dragEnabledDrag to resize | boolean | true |
dismissOnOverlayDismiss on overlay | boolean | true |
showHandleShow drag handle | boolean | true |
durationTransition duration 0–1000Step 10 | number | 500 |
easingTransition easing Options: glide (Glide), standard (Standard), linear (Linear) | select | "glide" |
beamEnabledShow edge beam | boolean | true |
beamPaletteBeam palette Options: adaptive, silver, blue, arclen, custom | select | "adaptive" |
beamColor1Gradient color 1 Used by the Custom beam palette. | color | "#003dff" |
beamColor2Gradient color 2 Used by the Custom beam palette. | color | "#0055ff" |
beamColor3Gradient color 3 Used by the Custom beam palette. | color | "#3366ff" |
beamColor4Gradient color 4 Used by the Custom beam palette. | color | "#0033ee" |
beamRestOpacityResting opacity 0–1Step 0.01 | number | 0 |
beamHoverOpacityHover / focus opacity 0–1Step 0.01 | number | 0.9 |
beamDragOpacityDragging opacity 0–1Step 0.01 | number | 1 |
beamDarkIntensityDark surface intensity Multiplies the entire beam opacity on dark surfaces, for every palette. Set to 1 for equal light and dark intensity. 0–1Step 0.05 | number | 0.85 |
beamLineThicknessLine thickness (px) 0.5–4Step 0.5 | number | 1 |
beamCoreHighlightCore highlight Mixes white into the crisp line only. The surrounding halo retains the selected palette. 0–1Step 0.05 | number | 0.85 |
beamGlowThicknessGlow thickness (px) 0–20Step 1 | number | 10 |
beamGlowBlurGlow blur (px) 0–12Step 0.5 | number | 4 |
beamGlowOpacityGlow opacity 0–1Step 0.01 | number | 0.7 |
beamDragGlowThicknessDragging glow thickness (px) 0–24Step 1 | number | 14 |
beamDragGlowOpacityDragging glow opacity 0–1Step 0.01 | number | 0.82 |
beamEndFadeEnd fade (%) 0–50Step 1 | number | 22 |
beamWidthBeam width (%) 10–100Step 1 | number | 100 |
beamActivationDistanceActivation distance (px) 0–72Step 1 | number | 12 |
beamFadeDurationFade duration (ms) 0–1000Step 10 | number | 180 |
beamEasingFade easing Options: ease, linear, ease-out | select | "ease" |
handleFeedbackEnabledHandle feedback | boolean | true |
handlePaletteHandle palette Options: adaptive, custom | select | "adaptive" |
handleHoverColorHover / focus color Used by the Custom handle palette. | color | "#93c5fd" |
handleDragColorDragging color Used by the Custom handle palette. | color | "#f5faff" |
handleFeedbackDurationColor transition (ms) 0–500Step 10 | number | 150 |
Snap Drawer
A bottom drawer for product quick views and other layered details. The default fictional Arc desk lamp shows its price and availability at the small snap, a short description and selection action at the middle snap, and specifications, delivery and returns in the full view. A subtle handle at the top edge signals that the panel can be dragged. Drag the panel or focus the handle and use Arrow Up/Down to change its height. Home selects the lowest view; End selects the highest. Set showHandle={false} to hide the resting visual cue; keyboard focus still reveals the handle.
Install and use
npx arclen-ui add snap-drawerImport SnapDrawer or its Component alias from the installed component directory. The React wrapper imports its stylesheet. The core has no runtime dependencies; the optional wrapper uses your application's React installation.
import { SnapDrawer } from './components/snap-drawer';
export default function ProductQuickView() {
return <SnapDrawer
theme="system"
snapPoints={['148px', '355px', '100%']}
initialSnap={0}
/>;
}The package includes its CSS and a local Geist font. Choose fontFamily="system" to use your system font. Place the trigger anywhere in normal document flow. The drawer uses a native modal dialog in the document's top layer, so its fixed panel fills the receiving viewport even inside a narrow or transformed container.
Snap points
Snap values are positive viewport anchors, written as pixels or percentages. They are not visible drawer heights. At a 1,000 px viewport, the default 97% panel is 970 px tall. The 148 px anchor translates it by 852 px, leaving 118 px visible. The 355 px anchor translates it by 645 px. The 100% anchor shows the full panel.
Provide two to five distinct anchors. initialSnap indexes your configured list. The component sorts reachable positions and maps your index to the corresponding position. Very low anchors are clamped to keep 96 px of the panel accessible; coincident positions are merged. A viewport shorter than that falls back to one full view.
A slow release chooses the nearest reachable view. A sustained fast upward release opens the highest view; a fast downward release dismisses. Dragging below the midpoint between the lowest view and the closed position also dismisses. Content scrolls at the highest reachable snap, including custom lists that omit 100%. A downward gesture transfers to the panel only at the top of its content. Mouse users can scroll with a wheel or trackpad; dragging a button or link activates that control instead of moving the panel.
Themes and content
Dark and system-dark drawers use a neutral charcoal surface (#171717). Custom theme colors remain controlled by your settings.
system follows the receiving device before and after JavaScript loads. light and dark use fixed palettes. Choose custom to use the seven color settings. The overlay opacity controls its background alpha; Adaptive separately fades the overlay when the panel settles at its highest snap. Constant keeps it dimmed whenever the drawer is open.
Each group's item titles and descriptions must have matching lengths. Empty groups are omitted. All text is escaped. Set actionHref to a relative path, hash, HTTP or HTTPS URL to render a same-tab link. Leave it empty for an action button. There is no checkout or payment integration.
The default demo uses title for the product name, metadata for price and availability, and description for a short introduction plus the selected option. The option is a text summary, not an interactive picker. The first group contains specifications; the second contains delivery and returns. Rating and quotation remain available but are hidden by default. Product claims and prices are fictional examples.
The API reference is generated from the package manifest and lists every setting, default and bound. Light, Dark, Short content, Roomy and Custom monochrome are preset setting objects. Short content omits specifications and retains delivery and returns. Preview size, pause and device controls are not exported settings.
Edge beam
The full top edge lights up near a mouse or hovering pen, while the focused handle and an active drag provide equivalent feedback. The default beam is off at rest and uses .9 hover opacity, full dragging opacity, a crisp 1px ice-blue core, and a 10px saturated glow with 4px blur and a wider soft halo. It adds no animation loop or pointer target.
The **Edge beam** group enables the effect and selects a palette. adaptive uses saturated electric blue in both light and dark modes. The dark-surface intensity multiplier (beamDarkIntensity, default .85) softens the whole beam on dark surfaces for every palette, including system-theme changes. The default effective hover opacity is .9 in light mode and .765 in dark mode; dragging is 1 and .85 respectively. Set the multiplier to 1 for equal intensity, or 0 to hide the beam on dark surfaces. For a custom surface, weighted RGB brightness below .5 counts as dark (the alpha channel is ignored). silver retains the neutral white/grey option; blue uses the same electric-blue colors as adaptive, and arclen uses ember/violet. All retain the configured dark-surface multiplier. custom uses the four **Beam colors** controls at 0%, 35%, 60% and 100% of the gradient.
**Beam appearance** controls resting, hover/focus and dragging opacity, line thickness, core highlight, glow thickness/blur/opacity, dragging glow thickness/opacity, end fade and centered width. beamCoreHighlight mixes white into the crisp line (default .85); zero preserves the palette color and one makes the core white. The surrounding halo retains the palette colors. Glow thickness and blur also set the wider halo spread, while glow opacity controls both glow layers. The default glow opacity is .7; dragging increases the glow to 14px at .82 opacity. Resting opacity is opt-in; disabling beamEnabled hides every beam state. Width changes only the painted beam, while the activation area remains the full top edge. **Beam interaction** controls activation distance above and below the edge, fade duration and easing. The default activation distance is 12px and fade is 180ms. Reduced motion removes beam transitions. Pause, document hiding and window blur suppress the decoration; pointer input can restore it when active again.
Beam and handle-feedback setting changes preserve the open drawer, current snap, content and keyboard focus. React props, core updates and configured HTML use the same manifest defaults and bounds.
Handle feedback
The handle stays neutral at rest, uses pale blue on hover or keyboard focus and near-white during a drag on dark surfaces. Light surfaces use clear blue and deeper royal blue for contrast. It has no separate halo. A subtle inset stroke uses the current theme text color to keep the active mark readable on light surfaces. The 64×44px interaction area, focus outline and showHandle behavior are unchanged: hiding the handle still leaves its keyboard-focused cue visible.
The **Handle feedback** group exposes handleFeedbackEnabled (true), handlePalette (adaptive or custom), handleHoverColor (#93c5fd), handleDragColor (#f5faff) and handleFeedbackDuration (150ms, 0–500ms). Adaptive follows the system or custom-surface brightness; Custom uses the two chosen colors in every theme. These settings are independent of the edge beam. Disabling feedback restores the neutral handle while preserving its focus outline. Pause, hidden tabs and window blur suppress active decoration; reduced motion makes color changes immediate. Updating these controls preserves the drawer's snap, scroll and focus.
Product images
Version 1.1.0 adds showImage, imageUrl and imageAlt; the existing 45 settings keep their defaults. The bundled fictional lamp photograph appears as a compact thumbnail beside the title and a larger square after the action. Both frames reserve their dimensions before loading. Expanding reveals the larger image without adding an image-growth animation.
Leave imageUrl empty for the bundled photograph. A custom source may be an HTTPS URL, a local path such as ./images/lamp.webp or /images/lamp.webp, a raster PNG/JPEG/WebP/GIF data URL, or a same-session HTTP/HTTPS blob URL. Relative paths resolve against the receiving page, including its subpath. Blob URLs are temporary and will not survive export into another session. Unsafe protocols, embedded credentials, whitespace and parent-directory paths are rejected. External image hosts receive a request only when that image is activated; make sure you have permission to use your replacement.
Set imageAlt to describe the replacement, or leave it empty for a decorative image. Only the large image is announced; its thumbnail is decorative. Failed images keep their reserved space and show “Image unavailable” without requesting a substitute. The product information and action remain usable.
Set showImage={false} to omit both image frames and sources entirely. An initially closed enhanced drawer keeps image definitions in inert templates, with no live image elements: opening loads the small rendition, and choosing the highest reachable snap loads the large rendition. A custom URL supplies both sizes. Closing removes still-pending image elements; loaded images may remain for reuse. Bytes already requested may remain in the browser cache. Image loading does not control the drawer's animation or delay the action.
Server-rendered HTML carries inert templates with deferred source attributes; mounting keeps the closed drawer's images deferred. Without JavaScript, a scoped noscript style hides the product-image frames and restores a text-only heading. The product details remain readable, and the standard HTML bundle retains its loaded poster. Product photographs themselves require JavaScript. If JavaScript runs but native dialogs are unavailable, the visible static view loads its images. Destroy restores readable static content without starting new image requests. Bundles still include local asset bytes even when an instance hides its images; image-off prevents requests, not distribution of packaged assets.
Configured example
import { SnapDrawer } from './components/snap-drawer';
export default function LampDetails() {
return <SnapDrawer
showImage={false}
triggerLabel="Quick view in Chalk"
title="Arc desk lamp"
metadata="$128 USD · In stock"
description={'Warm, dimmable light for a quieter desk.\nSelected: Chalk · USB-C'}
initialSnap={1}
groupOneTitle="Specifications"
groupOneTitles={['Light', 'Finish', 'Included']}
groupOneDescriptions={[
'2700 K warm white with three brightness levels.',
'Chalk powder-coated aluminum with a weighted base.',
'1.5 m USB-C cable. Power adapter sold separately.'
]}
actionLabel="Choose Chalk"
/>;
}Events and imperative use
"use client";
import { useState } from 'react';
import { SnapDrawer } from './components/snap-drawer';
export default function LampSelection() {
const [selection, setSelection] = useState('');
return <>
<SnapDrawer
onAction={event => {
setSelection(`${event.detail.settings.title} selected for this demo. No order was placed.`);
}}
/>
<p role="status">{selection}</p>
</>;
}Callbacks belong in a React client component. For plain JavaScript, import mount and resolveSettings from src/core. mount(host, settings) returns open(), close(), snapTo(configuredIndex), update(settings), pause(), resume() and destroy(). Updates accept a complete or partial settings object, with omitted fields restored to their defaults.
The host emits snap-drawer:open-change, snap-drawer:snap-change and a cancelable snap-drawer:action event. Preventing the action event keeps the drawer open. Otherwise its button dismisses the drawer. The example above uses that dismissal and displays a local selection confirmation; it does not create a cart, charge a payment or send a request. Connect the event to your own application when using real products. A link follows its URL normally.
Accessibility and lifecycle
The named dialog contains focus and makes the surrounding page inert. The drag handle receives initial focus. If the handle is hidden, the drawer sheet receives focus instead. The header has no close icon. If both drag and overlay dismissal are disabled, a text Close button remains available for touch and pointer users. Version 1.1.1 replaces the header arrow buttons with a keyboard-accessible drag handle. Its vertical slider announces the current view and available view count. Arrow Up/Right increases the view; Arrow Down/Left decreases it. Home and End select the lowest and highest reachable views, and focus stays on the handle at either endpoint. These keys only change the drawer when the handle is focused; content scrolling is unchanged. Tab stays among controls that are visible at the current snap. At the highest view, Tab also reaches the named reading region; use Arrow keys, Page Up, Page Down, Home and End to scroll it. Lowering the panel returns focus from that region to the handle, or to the sheet when the handle is hidden. Escape closes the drawer and returns focus to its initiating element. If that element was removed, focus returns to the inline trigger, then the host when available. Stacked drawers retain the page lock until the last one closes. Closing and immediately reopening the same controller keeps focus in the new opening; a previous close event does not dismiss it.
Reduced motion removes programmatic spatial travel. Pointer movement still follows your hand. Pausing settles the active transition and keeps essential controls usable; resuming does not replay it. Hidden documents settle safely. Destroy removes the modal, listeners and timers, restores owned page styles and reveals the readable static content.
Without JavaScript or native modal-dialog support, the content remains in normal flow beside a disabled enhancement trigger. The HTML bundle also includes a loaded poster for the no-JavaScript view. Without Pointer Events, touch gestures and visible keyboard controls remain available. Without matchMedia, CSS still follows the system color preference.
Delivery
React, plain JavaScript and HTML use the same core. Copy the complete package, including CSS, assets and notices. HTML assets use relative URLs and work under a subpath. No external font or runtime request is required.
The component code and bundled original AI-generated lamp photograph are MIT licensed. Geist retains its SIL Open Font License 1.1; keep assets/OFL-Geist.txt with the font. LICENSE, NOTICE.md and PROVENANCE.md describe the distributed files.
The preview runs the component’s own JavaScript. It respects reduced motion and pauses when off screen. The HTML bundle includes a static fallback.
Every setting in this panel comes from the component manifest. Preview size, pause and replay stay in the inspector.