Fejlesztőknek
Kezdj bele
Témák/Theme SDK/Modules/elements

elements

Ez az oldal még csak angolul érhető el.

Authoring: define and override sections and blocks, fields, slots, inline editing and child blocks.

Ezen az oldalon
import { … } from '@poltura/theme-sdk/elements';

Hooks

NameWhat it is
useElementThe section or block instance currently drawing.
useChildBlocksThe shown children of the current element in one region, in authored order and in the shopper's language.
useHasElementBackgroundWhether the element has a background: an image or video the merchant gave it.
useIsPageLeadWhether the section being drawn opens the page, so its picture is the largest one above the fold.

Parts

NameWhat it is
SlotDraws the children of the current section or block in one region, each through its own component and frame.
EditableTextA plain-text setting of the current element, editable in place on the customizer canvas; nothing when empty.
EditableRichTextA rich-text setting of the current element, editable in place on the customizer canvas.
ElementBackgroundThe background the merchant styled the current element with: image, video or overlay; nothing when unset.
ElementDividersThe shape dividers the merchant set on the current element's edges; nothing when unset.

Definers

NameWhat it is
defineSectionDeclares a section: its type key, inspector settings, children and the component that draws it.
defineBlockDeclares a block that draws itself inside the frame the platform puts around each instance.
defineThemeSettingsDeclares the theme settings panel in src/settings.ts: its groups and their field.* settings, keyed by their path in the theme's values.

Functions

NameWhat it is
overrideSectionSwaps the renderer of a platform section type; the platform keeps its schema, inspector and data.
overrideBlockSwaps the renderer of a platform block type everywhere it appears; the platform keeps its schema.
fieldSetA group of settings several elements share, such as a button's label and link; each call spreads its fields into a schema as <prefix>_<key>.
lazyBlockA component whose code loads in its own chunk, server-rendered unless ssr is false.

Constants

NameWhat it is
fieldThe setting builders a definition's settings object is written with.
ELEMENT_CATEGORIESEvery picker group, in picker order.
ELEMENT_WILDCARDIn accepts, admits any element.
THEME_BLOCK_WILDCARDIn accepts, admits the theme's and the installed apps' blocks.
STYLE_CAPABILITIESEvery style group an element can offer.

Types

NameWhat it is
LinkValueThe stored value of a link field: a bare URL or path, or the link with its options.
PlatformBlockSettingsThe settings of a platform block type, as the merchant set them.
PlatformBlockTypeA block type the platform ships.
PlatformSectionSettingsThe settings of a platform section type, as the merchant set them.
PlatformSectionTypeA section type the platform ships.
MediaValueThe stored value of a media field: a media:// library file, an asset:// theme file, an image URL, or '' when unset.
IconValueThe stored value of an icon field: a content icon name, lucide:<name>, logo:<id> for a platform logo, or svg:<markup> for a custom icon.
SettingsSchemaA settings object: setting id to field.* result, in inspector order.
SettingsOfThe settings a component receives for a schema; fields with a default are always present.
FieldSpecWhat a field.* builder returns: one setting's inspector description, carrying its value type.
FieldBuildersThe field builders, one per setting kind: text, number, colour, image, link, product and more.
FieldSetA reusable group of settings: call it with a prefix and spread the result into settings.
FieldSetOptionsWhat a field set's call takes beside its prefix: an optional heading, and this use's own defaults and locale paths.
ThemeSettingsDefinitionThe theme settings src/settings.ts declares: the panel's groups and their fields.
ThemeSettingsGroupDefinitionOne group of the theme settings panel: its id, heading and field.* settings by path.
ElementCategoryA picker group an element is listed under, such as marketing or product.
ElementIntentWhat a section is for: its kinds, moods, photos, products, height and source.
StyleCapabilityA group of style controls the inspector's Style tab offers, such as spacing or background.
ElementIconIdAn icon of the element picker and navigator.
ElementWordingOwn wording of an element, field, preset or slot by admin language, such as { hu: { label: 'Csempék' } }.
ElementSlotA named region of an element that Slot draws, with its label and accepted children.
ElementPresetA named starting configuration an element offers on insert; a plain insert applies default, other presets get their own tiles.
ElementScopeA data scope an element reads from above or opens for its children: product or collection.
SectionGroupA page-wide section group outside the templates: header or footer.
BlockFrameTagThe box the platform draws around each block instance: div, li, span, or self for platform elements.
ElementStyleStyle values in theme tokens, as an element instance stores them.
ElementSeedA child element a static block or preset starts with.
ElementSettingsSeedSettings an instance starts with, by setting id.
ElementAttrsAttributes to spread on the element's root node, so merchant styling, anchors and the editor reach it.
ElementRenderPropsWhat an element component receives for an already computed settings type.
ElementPropsWhat a section or block component receives for its settings schema.
ElementComponentA component that draws an element from its settings.
AcceptedBlockA defineBlock result named in accepts instead of its type key.
StaticBlockDefinitionOne fixed child of a section or block that merchants can hide and restyle but never move or delete.
ElementBlocksRuleWhich child elements an element accepts, in the customizer and in saved layouts.
ElementContextRuleScopes an element reads from above (requires) and opens for its children (provides).
ElementDefinitionBaseWhat sections and blocks share in their definition; every property is literal data the compiler reads statically.
SectionDefinitionThe object passed to defineSection.
BlockDefinitionThe object passed to defineBlock.
SectionElementA declared section, ready to export from a file under src/sections.
BlockElementA declared block, ready to export from a file under src/blocks or src/sections.
SectionOverrideA theme renderer for a platform section type whose schema, inspector and data the platform keeps.
BlockOverrideA theme renderer for a platform block type whose schema, inspector and data the platform keeps.
SlotTagThe element type of a slot's box; none draws the children straight into the parent.
SlotPropsProps of Slot.
EditableTextTagA tag EditableText can render.
EditableTextPropsProps of EditableText.
EditableRichTextPropsProps of EditableRichText.
ElementContextThe element instance currently drawing.
ChildBlockA child instance of the current element.
LazyBlockOptionsOptions of lazyBlock.
Utoljára frissítve