🎨
Valence
🎨
Valence
  • Overview
    • 👋Welcome to Valence
    • 🏄‍♂️Getting started
  • Core Concepts
    • Responsiveness
    • Color
      • List of colors
      • Color types
    • Polymorphism
  • Valence Core
    • 🏃‍♂️Fundamentals
      • 🎬The ValenceProvider
      • ✍️Using custom fonts
    • 🧱Components
      • 🔘Buttons
        • Button with icon
        • Grid Button
        • Text button
        • Icon button
        • Multi-part button
        • Unstyled button
        • Primitive button
      • ⌨️Inputs
        • Color Picker
        • Text input
        • Text area
        • Number input
        • Select input
        • Switch
        • Slider
        • Range slider
        • Pill selector
        • Input container
        • Dropdown container
      • 🖥️Display
        • Accordion
        • Alert
        • Color Swatch
        • Icon
        • Image
        • Avatar
        • Avatar Group
        • Loader
        • Pill
        • Spoiler
        • Stepper
        • Text
        • Title
      • 🧩Layout
        • App Container
        • Card
        • Flex
          • Flex Center
          • Styled Flex
        • Floating Toolbar
        • Grid
        • Header
        • Overflow Container
        • Space
      • 🗺️Navigation
        • App Nav
      • 🔼Overlays
        • Modal
        • Tooltip
        • Modal background
        • 📰Sheets
          • Bottom Sheet
          • Dynamic Sheet
          • Side Sheet
    • 🪝Hooks
      • UseColorScheme
      • UseColors
      • UseControlledList
      • UseDetectKeyDown
      • UseDisclosure
      • UseFloating
      • UseTooltip
      • UseBreakpoint
      • UseResponsiveProps
    • 🤚Generics
      • Generic button props
      • Generic input props
      • Generic Sheet Props
  • Valence Plugins
    • 🎠Valence Carousel
      • Carousel Child Props
  • Valence Utils
    • ✋Generics
      • Clickable
      • Events
      • Global
      • Grid
      • Layout
      • Overlay
      • Polymorphic
    • 🧜‍♀️Polymorphism
      • Polymorphic Button
      • Polymorphic Layout
      • Polymorphic Text
  • Update Notes
    • 3.0.0
    • 2.7.0
    • 2.6.0
    • 2.5.0
    • 2.4.0
    • 2.3.0
    • 2.2.0
    • 2.1.0
    • 2.0.0
Powered by GitBook
On this page
  • Usage
  • Changing the sheet type
  • Props
  • DynamicSheetType
  • Changelog

Was this helpful?

Edit on GitHub
  1. Valence Core
  2. Components
  3. Overlays
  4. Sheets

Dynamic Sheet

Last updated: 3.0.0 (04/07/2024)

PreviousBottom SheetNextSide Sheet

Last updated 11 months ago

Was this helpful?

In Valence 3, this component now imports from @valence-ui/core.

The Dynamic Sheet is a powerful responsive component that can be used to choose the best sheet for the context. It can be used to switch between the and as required, utilizing ideal UI patterns for the breakpoint on which your app is running.

Usage

import { DynamicSheet, useDisclosure, Button } from "@valence-ui/app";

function MyComponent() { 
    const disclosure = useDisclosure();

    return ( 
        <>
            <Button
                onClick={() => disclosure.open()}
            > 
                Open sheet!
            </Button>
            
            <DynamicSheet
                disclosure={disclosure}
                title="I'm a dynamic sheet!"
            >
                // Sheet content...
            </DynamicSheet>
        </>
    )
}

Changing the sheet type

By default, the Dynamic Sheet will be an inline Side Sheet, then change to an overlay Side Sheet on "tablet" breakpoints and a Bottom Sheet on "mobile" breakpoints. This behavior can be overridden with the type prop.

import { DynamicSheet, useDisclosure, Button } from "@valence-ui/app";

function MyComponent() { 
    const disclosure = useDisclosure();

    return ( 
        <>
            <Button
                onClick={() => disclosure.open()}
            > 
                Open sheet!
            </Button>
            
            <DynamicSheet
                disclosure={disclosure}
                title="I'm a dynamic sheet!"
                type={{
                    desktopLarge: "inline",
                    default: "overlay",
                    mobile: "bottom",
                }}
            >
                // Sheet content...
            </DynamicSheet>
        </>
    )
}

Props

Property
Type
Description

children (required)

ReactNode

disclosure (required)

A disclosure to handle the sheet's state.

title (required)

string

The title of the sheet.

type

DynamicSheetType

The type of the sheet.

sideSheetProps

Optional props to apply to the Side Sheet component, when displayed.

bottomSheetProps

Optional props to apply to the Bottom Sheet component, when displayed.

DynamicSheetType

export type DynamicSheetType = SideSheetDisplay | "bottom";

Changelog

  • 3.3.0: now imports from @valence-ui/core.

🧱
🔼
📰
breakpoint
Side Sheet
Bottom Sheet
Disclosure
SideSheetProps
BottomSheetProps