New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@zag-js/react

Package Overview
Dependencies
Maintainers
1
Versions
976
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@zag-js/react

The react wrapper for zag

  • 0.79.3
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created

What is @zag-js/react?

@zag-js/react is a collection of accessible, headless UI components for React. It provides a set of hooks and utilities to build custom UI components with accessibility and state management in mind.

What are @zag-js/react's main functionalities?

Accordion

The Accordion feature allows you to create collapsible sections of content. The useAccordion hook provides the necessary props to manage the state and accessibility of the accordion items.

import { useAccordion } from '@zag-js/react';

function AccordionComponent() {
  const { getAccordionProps, getItemProps } = useAccordion();
  return (
    <div {...getAccordionProps()}>
      <div {...getItemProps({ index: 0 })}>Item 1</div>
      <div {...getItemProps({ index: 1 })}>Item 2</div>
    </div>
  );
}

Tabs

The Tabs feature provides a way to create tabbed interfaces. The useTabs hook manages the state and accessibility of the tabs and their corresponding panels.

import { useTabs } from '@zag-js/react';

function TabsComponent() {
  const { getTabListProps, getTabProps, getTabPanelProps } = useTabs();
  return (
    <div>
      <div {...getTabListProps()}>
        <button {...getTabProps({ index: 0 })}>Tab 1</button>
        <button {...getTabProps({ index: 1 })}>Tab 2</button>
      </div>
      <div {...getTabPanelProps({ index: 0 })}>Content 1</div>
      <div {...getTabPanelProps({ index: 1 })}>Content 2</div>
    </div>
  );
}

Dialog

The Dialog feature helps in creating modal dialogs. The useDialog hook provides the necessary props to control the dialog's open/close state and ensure it is accessible.

import { useDialog } from '@zag-js/react';

function DialogComponent() {
  const { getDialogProps, getTriggerProps } = useDialog();
  return (
    <div>
      <button {...getTriggerProps()}>Open Dialog</button>
      <div {...getDialogProps()}>This is a dialog</div>
    </div>
  );
}

Other packages similar to @zag-js/react

Keywords

FAQs

Package last updated on 31 Dec 2024

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc