Media
Last updated
Was this helpful?
Last updated
Was this helpful?
/**
* @param {string} [label] - Component label.
* @param {string} [help] - Component description.
* @param {string} name - Attribute name.
* @param {function} [onSelect] - Callback called when a media item is selected.
* @param {object} attributes - Object containing block attributes.
* @param {function} setAttributes - Function to set new block attribute values.
*/
"testMedia": {
"type": "integer",
"default": 0
}
import {
TwebBlockMediaControl,
} from '@tigriweb/components/attributes';
<TwebBlockMediaControl
label={ __('Media Label', 'your-theme-name') }
help={ __('Media Description', 'your-theme-name') }
name="testMedia"
{...{ attributes, setAttributes }}
/>
/**
* @param {number} mediaId - The ID of the media item (default: 0).
* @param {boolean} [isBackground] - Should media be rendered as a background image? (default: false).
* @param {string} [className] - Additional CSS class name for the rendered component.
*/
{ attributes.testMedia && (
<TwebBlockMediaControl.Render
mediaId={ attributes.testMedia }
isBackground={ false }
className="test-media"
/>
) }