Socket
Book a DemoInstallSign in
Socket

@zendeskgarden/container-splitter

Package Overview
Dependencies
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@zendeskgarden/container-splitter

Containers relating to Splitter in the Garden Design System

latest
Source
npmnpm
Version
2.0.21
Version published
Weekly downloads
38K
-18.09%
Maintainers
1
Weekly downloads
 
Created
Source

@zendeskgarden/container-splitter npm version

This package includes containers relating to Splitter in the Garden Design System.

Installation

npm install @zendeskgarden/container-splitter

Usage

This container implements the window splitter design pattern and can be used to build a splitter component. Check out storybook for live examples.

useSplitter

The useSplitter hook manages positioning and required accessibility attributes for the window splitting separator.

import {
  useSplitter,
  SplitterType,
  SplitterOrientation,
  SplitterPosition
} from '@zendeskgarden/container-splitter';

const Splitter = () => {
  const { getSeparatorProps, getPrimaryPaneProps, valueNow } = useSplitter({
    label: 'primary-pane',
    type: SplitterType.VARIABLE,
    orientation: SplitterOrientation.VERTICAL,
    min: 50,
    max: 100,
    position: SplitterPosition.TRAILS,
    environment: window
  });

  const separatorProps = getSeparatorProps();
  const primaryPaneProps = getPrimaryPaneProps();

  return (
    <div style={{ display: 'flex' }}>
      <div {...primaryPaneProps} style={{ flex: `0 0 ${valueNow}px` }}>
        <p>Primary Pane</p>
      </div>
      <div style={{ flex: '0 0 5px' }} {...separatorProps} />
      <div style={{ flex: '1 1 auto' }}>
        <p>Secondary Pane</p>
      </div>
    </div>
  );
};

SplitterContainer

SplitterContainer is a render-prop wrapper for the useSplitter hook.

import {
  SplitterContainer,
  SplitterType,
  SplitterOrientation,
  SplitterPosition
} from '@zendeskgarden/container-splitter';

<SplitterContainer
  label="primary-pane"
  type={SplitterType.VARIABLE}
  orientation={SplitterOrientation.VERTICAL}
  min={50}
  max={100}
  position={SplitterPosition.TRAILS}
  environment={window}
>
  {({ getSeparatorProps, getPrimaryPaneProps, valueNow }) => {
    const separatorProps = getSeparatorProps();
    const primaryPaneProps = getPrimaryPaneProps();

    return (
      <div id="container" style={{ display: 'flex' }}>
        <div {...primaryPaneProps} style={{ flex: `0 0 ${valueNow}px` }}>
          <p>Primary Pane</p>
        </div>
        <div style={{ flex: '0 0 5px' }} {...separatorProps} />
        <div style={{ flex: '1 1 auto' }}>
          <p>Secondary Pane</p>
        </div>
      </div>
    );
  }}
</SplitterContainer>;

Keywords

a11y

FAQs

Package last updated on 05 Aug 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts