Skip to content

HideElementState

Type alias for the editor's device-specific hidden-element state.

typescript
type HideElementState = 'desktop' | 'mobile' | undefined

Description

HideElementState represents whether the editor hides a node on a specific device mode. It is used by BlockApi to read the current state and by HtmlNodeModifier to update it through template modifications.

Import

typescript
import type { HideElementState } from '@stripoinc/ui-editor-extensions';

Values

ValueDescription
'desktop'The target node is hidden on desktop
'mobile'The target node is hidden on mobile
undefinedNo device-specific hidden state is applied

Example

typescript
const state: HideElementState = this.api.getHiddenElementState(node);

this.api.getDocumentModifier()
    .modifyHtml(node)
    .setHiddenElementState(state === 'mobile' ? undefined : 'mobile')
    .apply(new ModificationDescription('Toggle mobile visibility'));