Start sharing components as a team!Share components as a team!Join Bit to build your applications faster.Get Started Free

layer

v2.6.5arrow_drop_down
v2.6.5
v2.5.5
STATUS
Passing
DOWNLOADS
54
LICENSE
Apache 2.0
VISIBILITY
Public
PUBLISHED
7 months ago
SIZE
28 KB
An overlay. Layer is typically modal and anchored to an edge, corner, or
1 contributor
Use layer in your project ?
Copied
npm i @bit/grommet.grommet.layer
Set Bit as a scoped registryLearn more
npm config set '@bit:registry' https://node.bit.dev
Component Example
React
React
Vue
Angular
Add dependency... help_outline
Just
import
any of the 1 million components
and packages in Bit or NPM to the example.
import Button from '@bit/grommet.grommet.button';
import Lodash from 'lodash';
toggle layout
modifieddraft
chevron_left
chevron_right

Layer

An overlay. Layer is typically modal and anchored to an edge, corner, or center of the window. It is the caller’s responsibility to provide a control for the user to close the layer.

Usage

import { Layer } from 'grommet';
<Layer />

Properties

animate

Animation transition of the Layer content when it opens. Defaults to true.

boolean

full

Whether the width and/or height should fill the current viewport size.

boolean
vertical
horizontal

margin

The amount of margin around the Layer. An object can be specified to distinguish horizontal margin, vertical margin, and margin on a particular side of the layer Defaults to none.

none
xxsmall
xsmall
small
medium
large
{
  bottom: 
    xxsmall
    xsmall
    small
    medium
    large
    string,
  horizontal: 
    xxsmall
    xsmall
    small
    medium
    large
    string,
  left: 
    xxsmall
    xsmall
    small
    medium
    large
    string,
  right: 
    xxsmall
    xsmall
    small
    medium
    large
    string,
  top: 
    xxsmall
    xsmall
    small
    medium
    large
    string,
  vertical: 
    xxsmall
    xsmall
    small
    medium
    large
    string
}
string

modal

Whether there should be an overlay preventing interaction underneath the layer. Defaults to true.

boolean

onClickOutside

Function that will be invoked on modal layers when the user clicks outside the layer.

function

onEsc

Function that will be called when the user presses the escape key inside the layer.

function

plain

Whether this is a plain Layer with no background color or border.

boolean

position

Position of the layer content. Defaults to center.

bottom
bottom-left
bottom-right
center
hidden
left
right
top
top-left
top-right

responsive

Whether the layer should take full width and height on mobile Defaults to true.

boolean

Intrinsic element

div

Theme

global.size.xxsmall

The minimal height of the Layer. Expects string.

Defaults to

48px

layer.background

The background color of the Layer Container. Expects string.

Defaults to

white

layer.container.zIndex

The stack order of Layer Container. Expects number.

Defaults to

15

layer.extend

Any additional style for Layer. Expects string | (props) => {}.

Defaults to

undefined

layer.overlay.background

The background of the Layer overlay. Expects string.

Defaults to

rgba(0, 0, 0, 0.5)

layer.responsiveBreakpoint

The actual breakpoint to trigger changes in the border, direction, gap, margin, pad, and round. Expects string.

Defaults to

small

layer.zIndex

The stack order of Layer. Expects number.

Defaults to

10

global.breakpoints

The possible breakpoints that could affect border, direction, gap, margin, pad, and round. Expects object.

Defaults to

{
    small: {
      value: '768px',
      borderSize: {
        xsmall: '1px',
        small: '2px',
        medium: '4px',
        large: '6px',
        xlarge: '12px',
      },
      edgeSize: {
        none: '0px',
        hair: '1px',
        xxsmall: '2px',
        xsmall: '3px',
        small: '6px',
        medium: '12px',
        large: '24px',
        xlarge: '48px',
      },
      size: {
        xxsmall: '24px',
        xsmall: '48px',
        small: '96px',
        medium: '192px',
        large: '384px',
        xlarge: '768px',
        full: '100%',
      },
    },
    medium: {
      value: '1536px',
    },
    large: {},
  }