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
visibleManages Sheet visibilitybooleanfalse
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
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
titleSheet window title.stringundefined
classNameclass HTML attributestringundefined
contentClassNameclass HTML attribute for the sheet content.stringundefined
swipeAreaClassNameclass HTML attribute for the swipe area.stringundefined
onCloseHandler for close event.functionundefined
maxContentHeightCoefficientCoefficient that determines the maximum height of the Sheet relative to the height of the viewport (range 0-1)number0.9
alwaysFullHeightSheet height will always have the maximum valuebooleanundefined

CSS API

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