Grapes homepage1.57.0
  • Guide
  • Tokens
  • Components
    Grapes on GithubGrapes on Figma
    Interaction
    • Button
    • IconButton
    • FloatingActionBar
    • Link
    Icons
    • Icon
    • HighlightIcon
    Form
    • AmountInput
    • Autocomplete
    • AutocompleteMultiple
    • AutocompletePlace
    • CheckboxBox
    • CheckboxField
    • DatePicker
    • FormField
    • Input
    • OptionGroup
    • PasswordInput
    • PhoneInput
    • RadioBox
    • RadioField
    • RadioGroup
    • Select
    • SwitchField
    • TextArea
    • TextInput
    • Upload
    • UploadButton
    Feedback
    • Badge
    • Banner
    • Callout
    • EmptyState
    • Modal
    • ModalSlideshow
    • DeprecatedModalSlideshow
    • PageModal
    • Skeleton
    • Tag
    • Toast
    • Tooltip
    Data display
    • Accordion
    • Avatar
    • Box
    • Calendar
    • CalendarRange
    • CollapsibleList
    • FileCard
    • InfoTip
    • ListBox
    • ListView
    • Panel
    • SidePanel
    • DeprecatedPreview
    • Table
    • Timeline
    • useDateFormatter
    Navigation
    • DropdownItem
    • DropdownMenu
    • Navigation
    • NavigationItem
    • Popover
    • Tabs

    Navigation

    A Navigation displays a horizontal list of pages that are accessible to a user.

    View source code
    • Usage
    • Props

    Import

    • Navigation: The navigation component.
    • NavigationItem: A helper component designed to represent an item inside a navigation list.

    Basic usage

    The navigation presents a list of navigation items at the top to help the user navigate between pages. Please refer to the NavigationItem docs for more information on how to create the different links (emphasized, with icon, etc.).

    The children prop is used to display the items in the navigation menu.

    • Link 1
    • Link 2
    • Link 3
    const Demo = () => {
      const [activeIndex, setActiveIndex] = useState(1);
    
      return (
        <Navigation>
          <NavigationItem
            key="1"
            text="Link 1"
            isActive={activeIndex === 1}
            onClick={() => setActiveIndex(1)}
          />
          <NavigationItem
            key="2"
            text="Link 2"
            isActive={activeIndex === 2}
            onClick={() => setActiveIndex(2)}
          />
          <NavigationItem
            key="3"
            text="Link 3"
            isActive={activeIndex === 3}
            onClick={() => setActiveIndex(3)}
          />
        </Navigation>
      );
    };