🔧 Volto widgets#
sc-videos registers several Volto widgets for editing and displaying video-related fields.
✏️ VideoURLWidget (edit)#
The primary widget for entering video URLs and fetching metadata. Used both in the content type's sidebar form and inside the Video Player block's in-block 🧱 Blocks and widgets.
Registration: config.widgets.widget.VideoURL
Module: components/Widgets/VideoURLWidget.tsx
Storybook: Widgets/VideoURL/Edit
Props#
Prop |
Type |
Required |
Description |
|---|---|---|---|
|
|
Yes |
Field name (for example, |
|
|
Yes |
Field label. |
|
|
No |
Help text shown below the field. |
|
|
No |
Current URL value. |
|
|
No |
Parent form data. Used to read |
|
|
Yes |
Called on every keystroke and by |
|
|
Yes |
Called when the input loses focus. |
|
|
Yes |
Called when the input is clicked. |
|
|
No |
Input placeholder text. |
|
|
No |
Disable the input. |
|
|
No |
Mark the field as required. |
|
|
No |
Validation error messages. |
Behavior#
Typing: updates the field value on every keystroke via
onChange.Arrow button (→). triggers
fetchVideoMetadata(), which calls the 🌐 REST API. @video-metadata and then runsapplyVideoMetadataToForm()to populate sibling fields (title, description, duration, etc.).Clear button (✕). resets the URL and clears
_metadata.Metadata preview: when
_metadatais populated, shows a thumbnail, channel, and duration below the input.Multi-instance sync: a
useEffectre-syncs local state withprops.valueso multiple instances of the widget (for example, in-block EditForm + content sidebar) stay consistent.
Metadata population#
When the arrow button is clicked and metadata is fetched successfully, applyVideoMetadataToForm() writes to these sibling fields (only if currently empty):
Form field |
Metadata source |
Transform |
|---|---|---|
|
|
. |
|
|
Truncated per |
|
|
. |
|
|
. |
|
|
. |
|
|
. |
|
|
. |
|
full metadata object |
Always written |
👁️ VideoURLWidgetView (view)#
Read-only display of a video URL as a clickable link.
Registration: config.widgets.views.widget.VideoURL
Module: components/Widgets/VideoURLWidgetView.tsx
Storybook: Widgets/VideoURL/View
Props#
Prop |
Type |
Required |
Description |
|---|---|---|---|
|
|
No |
The URL to display. |
|
|
No |
Custom render function. |
|
|
No |
CSS class name. |
🔒 VideoMetadataWidget (edit)#
A hidden widget that stores the raw metadata JSON in form state. Renders no visible UI. purely a data-storage mechanism.
Registration: config.widgets.widget.VideoMetadata
Module: components/Widgets/VideoMetadataWidget.tsx
Storybook: Widgets/VideoMetadata/Edit
👁️ VideoMetadataWidgetView (view)#
View-mode counterpart of VideoMetadataWidget. Also renders nothing. consumed programmatically.
Registration: config.widgets.views.widget.VideoMetadata
🔍 VideoInput#
An in-block placeholder component for picking existing Video content. Used by the Video block when no video is selected.
Module: components/Widgets/VideoInput.tsx
Storybook: Widgets/VideoInput/Edit
Props#
Prop |
Type |
Required |
Description |
|---|---|---|---|
|
|
No |
Block or field ID. |
|
|
No |
Block ID (used by |
|
|
No |
Custom placeholder text. |
|
|
No |
Whether the host block is currently selected. |
|
|
No |
Called when the placeholder is clicked. |
|
|
Yes |
Called when a Video is picked from the object browser. |
Behavior#
Renders a camera icon, descriptive text, and a browse button.
Clicking the browse button opens the Volto object browser with:
mode: 'link'searchableTypes: ['Video']selectableTypes: ['Video']
On selection, calls
onSelectItemwith the item's URL and full catalog metadata.The hosting block's
dataAdapteris responsible for committing the selection to block data.
Wrapped with the withObjectBrowser HOC so it manages its own object browser popup state.
See also
🧱 Volto blocks. How these widgets are used within the blocks.
🧱 Blocks and widgets. Architectural overview of the widget/block relationship.