Overview
The Admin SDK allows you to:- Register custom CMS elements
- Register custom CMS blocks
- Create configuration interfaces for your elements
- Render custom content in the CMS
CMS Elements
CMS elements are the building blocks of the Shopping Experiences. Each element represents a specific type of content.Registering a CMS Element
Element Location IDs
When you register an element, three location IDs are automatically generated:Complete CMS Element Example
Here’s a complete example for a video element:1. Register the Element
2. Create the Preview Component
3. Create the Configuration Component
4. Create the Element Component
CMS Blocks
CMS blocks are containers that hold one or more CMS elements in a specific layout.Registering a CMS Block
Block Parameters
- name: Unique identifier (use vendor prefix)
- label: Display name in the block selector
- category: Block category (see below)
- slots: Array of element slots
- slotLayout: CSS grid layout configuration
- previewImage: Preview image URL (min width: 350px)
Block Categories
Available categories:commerce- Commerce-related blocksform- Form elementsimage- Image blockssidebar- Sidebar elementstext-image- Text and image combinationstext- Text blocksvideo- Video blocks
Grid Layouts
Thegrid property uses CSS grid shorthand:
Complete Block Example
Real-World Example: Dailymotion Element
Here’s a complete example from the admin-sdk-app:Configuration Best Practices
- Use meaningful names: Include vendor prefix (e.g.,
my-company-element-name) - Provide defaults: Always set sensible default values
- Source types: Use
staticfor fixed values,mappedfor dynamic data - Validation: Validate user input in config components
- Live preview: Subscribe to config changes in element components
Config Object Structure
The default config structure:Next Steps
- See the Custom CMS Block Example for a complete implementation
- Learn about Building Apps for app structure
- Check out Data Management for working with CMS data