SDK components
The SDK provides a flexible set of components for actions, containers, navigation, and text that you can combine and customize to build your storefront interface.
Rendering a component
Section titled “Rendering a component”Storefront blocks are plain JavaScript to which you add an SDK component by calling provider.render with the component and its props, then the target element. It returns an instance you keep to update or remove the component later:
import { Button, provider } from '/@dropins/tools/components.js';
// provider.render(Component, props) returns a function;// calling that function with a target element mounts the component into it.const instance = await provider.render(Button, { children: 'Add to cart', onClick: yourAddToCart,})(document.querySelector('.add-to-cart'));
// Update props after render:instance.setProps((prev) => ({ ...prev, disabled: true }));
// Remove the component:instance.remove();Components
Section titled “Components”The SDK provides the following collection of reusable UI components:
- Accordion - Expandable content sections
- ActionButton - Button with loading states
- ActionButtonGroup - Group of action buttons
- AlertBanner - Notification banner
- Breadcrumbs - Navigation breadcrumbs
- Button - Basic button component
- Card - Content container
- CartItem - Shopping cart item
- CartList - Shopping cart list
- Checkbox - Checkbox input
- ColorSwatch - Color selection swatch
- ContentGrid - Grid layout for content
- Divider - Horizontal divider
- Field - Form field wrapper
- Header - Page header
- Icon - SVG icon component
- IllustratedMessage - Illustration with text
- Image - Image component
- ImageSwatch - Image selection swatch
- Incrementer - Incrementer component
- InlineAlert - Inline alert component
- Input - Text input field
- InputDate - Date input field
- InputFile - File upload input
- InputPassword - Password input field
- LiveRegion - Screen reader announcements for dynamic content
- Modal - Modal component
- MultiSelect - Multi-option select with search and bulk actions
- Pagination - Page navigation
- Picker - Selection picker
- Portal - Mount UI outside the parent DOM tree
- Price - Price display
- PriceRange - Price range display
- ProductItemCard - Product information card
- ProgressSpinner - Loading indicator
- RadioButton - Radio button input
- Skeleton - Loading placeholder
- Table - Structured, sortable data table
- Tag - Label tag
- TextArea - Multi-line text input
- TextSwatch - Text selection swatch
- ToggleButton - Toggle switch button