Sheet

title
hideTopBar
allowHideOnContentScroll
import {Sheet} from '@gravity-ui/uikit';

Sheet is a component designed for using in the mobile context as an information or interactive element. You can place content of any size in it, since the internal scrolling and dynamic resizing are supported.

On mobile devices, you can move a Sheet by pulling its main part or the swipe area. To close it, swipe down or tap the area outside the Sheet.

Usage

import React from 'react';
import {Button, Sheet} from '@gravity-ui/uikit';

const SheetExample = () => {
  const [visible, setVisible] = React.useState(false);

  return (
    <React.Fragment>
      <Button onClick={() => setVisible(true)}>Open Sheet</Button>
      <Sheet visible={visible} onClose={() => setVisible(false)} title="Content Sheet">
        Content
      </Sheet>
    </React.Fragment>
  );
};

Properties

NameDescriptionTypeDefault
allowHideOnContentScrollEnables the behavior of closing the sheet window by swiping down if the content is scrolled to its top (content Node.scrollTop === 0) or has no scroll at all.booleantrue
alwaysFullHeightSheet height will always have the maximum valuebooleanundefined
classNameclass HTML attributestringundefined
containerDOM element to which component is mounted via PortalHTMLElementdocument.body
contentClassNameclass HTML attribute for the sheet content.stringundefined
disablePortalDisables using Portalbooleanfalse
hideTopBarHides the top bar with the resize handle.boolean
idSheet ID used as hash in a URL. Make sure to specify multiple id values if there can be more than one sheet on a page.stringmodal
maxContentHeightCoefficientCoefficient that determines the maximum height of the Sheet relative to the height of the viewport (range 0-1)number0.9
onCloseHandler for close event.functionundefined
swipeAreaClassNameclass HTML attribute for the swipe area.stringundefined
titleSheet window title.stringundefined
visibleManages Sheet visibilitybooleanfalse

CSS API

NameDescription
--g-sheet-content-paddingContent padding
--g-sheet-background-colorBackground color