
Security News
OpenGrep Restores Fingerprinting in JSON and SARIF Outputs
OpenGrep has restored fingerprint and metavariable support in JSON and SARIF outputs, making static analysis more effective for CI/CD security automation.
@zag-js/react
Advanced tools
@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.
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>
);
}
Headless UI is a set of completely unstyled, fully accessible UI components, designed to integrate beautifully with Tailwind CSS. It provides similar functionality to @zag-js/react but is more tightly integrated with Tailwind CSS, making it a great choice for projects already using Tailwind.
React Aria is a library of React Hooks that provides accessible UI primitives. It offers similar headless components and focuses on accessibility, much like @zag-js/react, but with a broader range of low-level hooks for building custom components.
FAQs
The react wrapper for zag
The npm package @zag-js/react receives a total of 164,560 weekly downloads. As such, @zag-js/react popularity was classified as popular.
We found that @zag-js/react demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
OpenGrep has restored fingerprint and metavariable support in JSON and SARIF outputs, making static analysis more effective for CI/CD security automation.
Security News
Security experts warn that recent classification changes obscure the true scope of the NVD backlog as CVE volume hits all-time highs.
Security Fundamentals
Attackers use obfuscation to hide malware in open source packages. Learn how to spot these techniques across npm, PyPI, Maven, and more.