Appearance
HideElementState
Type alias for the editor's device-specific hidden-element state.
typescript
type HideElementState = 'desktop' | 'mobile' | undefinedDescription
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
| Value | Description |
|---|---|
'desktop' | The target node is hidden on desktop |
'mobile' | The target node is hidden on mobile |
undefined | No 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'));