# Layer component

Layer is a floating box component, which is typically used to implement dialogs, tooltips, context menus, and some other components that need to float on other elements.

# Code examples

# Getting started

# Create a layer with header

# Create a draggable layer

# Create a modal layer

# Specify a parent node for the layer component

By default, the layer DOM nodes are appended to the end of the root component when the layer is displayed. This may cause the layer DOM hierarchy to display incorrectly in some cases. To avoid this problem, you can specify where to insert the layer DOM when calling show(). Here is the code example:

# API

# Layer component template

Template example:

<layer class="center" visible modal backdrop>
    <layer-header title="" icon-class="fv__icon-toolbar-print"></layer-header>
</layer>

The <layer>component template properties:

Property Description Type Default value Version
visible Whether make the layer visible boolean false 7.0.0
modal Whether it is a modal box boolean false 7.0.0
backdrop Whether the modal box uses a black translucent background boolean false 7.0.0
class="center" Center layer -- -- 7.0.0
class="centerv" Vertically center layer -- -- 7.0.0
class="centerh" Horizontally center layer -- -- 7.0.0
class="left" Show the layer on the left -- -- 7.0.0
class="right" Show the layer on the right -- -- 7.0.0
class="top" Show the layer on the top -- -- 7.0.0
class="bottom" Show the layer on the bottom -- -- 7.0.0

The <layer-header>component template properties :

Property Description Type Default value Version
title Title contents string '' 7.0.0
icon-class Title icon string '' 7.0.0

# Methods

Method Description Version
show(appendTo: HTMLElement): void Append the layer components to a specified DOM node, and show. 7.0.0
open(appendTo: HTMLElement): void Function same as show() 7.0.0
hide(): void Hide layer 7.0.0
close(): void Hide and destroy layer 7.0.0

# Events

Name Description Sample Version
shown Triggered after the layer displays layer.on('shown', () => void) 7.0.0
hidden Triggered after the layer is hidden layer.on('hidden', () => void) 7.0.0
closed Triggered after the layer is hidden and destroyed layer.on('closed', () => void) 7.0.0