@zendeskgarden/react-chrome npm version

Collection of elements, render prop containers, and presentation components relating to the Chrome component within the Garden Design System

Installation

npm install @zendeskgarden/react-chrome

# Peer Dependencies - Also Required
npm install react react-dom prop-types styled-components @zendeskgarden/react-theming

Usages

/**
 * Include chrome styling at the root of your application
 */
import '@zendeskgarden/react-chrome/dist/styles.css';

import { ThemeProvider } from '@zendeskgarden/react-theming';
import { Chrome, Nav, NavItem, ... } from '@zendeskgarden/react-chrome';
import ConnectIcon from '@zendeskgarden/icons/src/26/relationshape-connect.svg';

<ThemeProvider>
  <Chrome>
    <Nav expanded>
      <NavItem logo product="connect" title="Zendesk Connect">
        <NavItemIcon>
          <ConnectIcon />
        </NavItemIcon>
        <NavItemText>Zendesk Connect</NavItemText>
      </NavItem>
      <NavItem current>
        <NavItemIcon>
          <HomeIcon />
        </NavItemIcon>
        <NavItemText>Home</NavItemText>
      </NavItem>
    </Nav>
    <SubNav>
      <SubNavItem current>
        <SubNavItemText>Subnav 1</SubNavItemText>
      </SubNavItem>
      ...
    </SubNav>
    <Body>
      <Header>
        ...
      </Header>
      <Content>
        <Main>
          Lorem ipsum...
        </Main>
      </Content>
    </Body>
  </Chrome>
</ThemeProvider>
import { Chrome } from '@zendeskgarden/react-chrome'

Accepts all <div> props

Simple Usage

Due to the wide variety of routing strategies within React, the Chrome component doesn't provide any opinionated navigation solutions.

All NavItem and SubNavItem components are button elements that accept all native props. If you are using a routing library like react-router, you can programmatically trigger navigation with the onClick events.

import { CollapsibleSubNavItem } from '@zendeskgarden/react-chrome'

Accepts all <button> props

Prop name
Type
Default
Description
children
node
-
expanded
bool
-
focused
bool
-
header
any
-
hovered
bool
-
onChange
func
-
import { Header } from '@zendeskgarden/react-chrome'

Accepts all <header> props

Prop name
Type
Default
Description
standalone
bool
-

Display logo for standlone usage

Example flex-grow content
import { HeaderItem } from '@zendeskgarden/react-chrome'

Accepts all <button> props

Prop name
Type
Default
Description
active
bool
-
focused
bool
-
hovered
bool
-
logo
bool
-

Style the product logo shown as the first item in the header

maxX
bool
-

Horizontally maximize a flex item in the header to take as much space as possible (i.e. breadcrumb container)

maxY
bool
-

Vertically maximize the height for a header item (i.e. contains a search input)

product
enum
-

Applies product-specific color palette

One of: chat, connect, explore, guide, message, support, talk
round
bool
-

Round the border radius for a header item (i.e. user icon)

States

import { HeaderItemIcon } from '@zendeskgarden/react-chrome'

Applies styling directly to child component

Prop name
Type
Default
Description
children
node
-
import { HeaderItemText } from '@zendeskgarden/react-chrome'

Accepts all <span> props

Prop name
Type
Default
Description
clipped
bool
-

Clip text (but leave accessible to screenreaders) for an icon-only header item

import { HeaderItemWrapper } from '@zendeskgarden/react-chrome'

Accepts all <div> props

Prop name
Type
Default
Description
active
bool
-
focused
bool
-
hovered
bool
-
logo
bool
-

Style the product logo shown as the first item in the header

maxX
bool
-

Horizontally maximize a flex item in the header to take as much space as possible (i.e. breadcrumb container)

maxY
bool
-

Vertically maximize the height for a header item (i.e. contains a search input)

product
enum
-

Applies product-specific color palette

One of: chat, connect, explore, guide, message, support, talk
round
bool
-

Round the border radius for a header item (i.e. user icon)

import { FooterItem } from '@zendeskgarden/react-chrome'

Accepts all <div> props

import { Body } from '@zendeskgarden/react-chrome'

Accepts all <div> props

Prop name
Type
Default
Description
hasFooter
bool
-

Prepare the body content height to allow space for a footer component

import { Content } from '@zendeskgarden/react-chrome'

Accepts all <div> props

import { Main } from '@zendeskgarden/react-chrome'

Accepts all <main> props