✨ New example on Ariakit: Warning on Dialog hide
This works in a way similar to the Twitter/X Post dialog. If there are unsaved changes, a nested dialog is displayed to prevent users from inadvertently closing the primary one.
Demo and code → ariakit.org/examples/dialog-…
✨ New example on Ariakit: Warning on Dialog hide
This works in a way similar to the Twitter/X Post dialog. If there are unsaved changes, a nested dialog is displayed to prevent users from inadvertently closing the primary one.
Demo and code → ariakit.org/examples/dialog-…
The Ariakit Select component can be animated during both the enter and leave states using data attributes and CSS transitions.
It waits for the exit animation to complete before hiding or unmounting the component.
Take a look at the example: ariakit.org/examples/select-…
The Ariakit submenu example has been enhanced with component providers.
This section details how menus can be nested in the React tree to generate submenus: ariakit.org/examples/menu-ne…
ALT A screenshot of the Ariakit documentation on the exact section linked in the post.
Ariakit v0.3.1 introduces a new API for accessing the context.
For example, you can use it to determine whether you're in a submenu or not: ariakit.org/guide/component-…
ALT Screenshot of the page linked in the post with the following text:
Using React Context
If you're inside a React component that's wrapped within an Ariakit component provider, you can benefit from Ariakit context hooks to access the nearest component store in the tree:
// A MenuButton that also behaves as a MenuItem when it's in a submenu
function MenuButton(props) {
const menu = useMenuContext();
const render = menu?.parent ? <Ariakit.MenuItem /> : undefined;
return <Ariakit.MenuButton {...props} render={render} />;
}
Ariakit v0.3 is now available!
The `as` prop and the `children` function prop have been deprecated in favor of the `render` prop (ariakit.org/guide/compositio…).
We've also made some updates related to component providers.
Release page 👇🏽
github.com/ariakit/ariakit/r…
This is how a custom Ariakit Select + Combobox component will look with component providers.
Component providers are high-level APIs built on top of the existing component stores. No breaking changes here.
Creating menus with submenus in Ariakit will soon become much easier with component providers.
It's a higher-level API built on top of component stores.
Read the RFC by @daniguardio_la for more details: github.com/ariakit/ariakit/i…
ALT The following JSX code:
<MenuProvider>
<MenuButton>Edit</MenuButton>
<Menu>
<MenuItem>Undo</MenuItem>
<MenuItem>Redo</MenuItem>
<MenuProvider>
<MenuButton>Find</MenuButton>
<Menu>
<MenuItem>Find Next</MenuItem>
<MenuItem>Find Previous</MenuItem>
</Menu>
</MenuProvider>
<MenuProvider>
<MenuButton>Speech</MenuButton>
<Menu>
<MenuItem>Start Speaking</MenuItem>
<MenuItem>Stop Speaking</MenuItem>
</Menu>
</MenuProvider>
</Menu>
</MenuProvider>
ALT A screenshot of an Edit menu button with 4 items: Undo, Redo, Find, Speech. The last two items, Find and Speech, are sub-menu buttons. The Find submenu is open.
Thinking of an API for a ContextMenu component that could also work with a MenuButton.
The ContextMenu will be positioned based on the mouse's location when the user right-clicks in the context menu area.
It will anchor to the MenuButton when triggered by it.
ALT The following code:
const store = useMenuStore();
<>
<MenuButton store={store}>Or click here</MenuButton>
...
<ContextMenuArea store={store}>
Right click here
<ContextMenu>
<MenuItem>Item</MenuItem>
<MenuItem>Item</MenuItem>
<MenuItem>Item</MenuItem>
<MenuItem>Item</MenuItem>
</ContextMenu>
</ContextMenuArea>
</>
The RSC Devtools extension is now published! 🎉Didn't get an email when it got approved so I missed the release date. But now anyone can try it.
Try it out and tell me what you think in the replies or on GitHub!
chrome.google.com/webstore/d…
ALT Screenshot of the RSC Devtools extension page on the Chrome Web store.
The @ariakit/react package has hit 24k downloads per week ✨
Still a long way to go—it's currently at about 10% of the download rate of the reakit and ariakit packages—but adoption is growing swiftly.
ALT Screenshot of npm statistics showing 24k weekly downloads
Introducing Ariakit's Coding Guidelines ✨
This document explains why we:
✦ Prefer interfaces over types
✦ Name functions inside forwardRef
While primarily intended for our docs, you can also use them as a reference for your app code if desired.
ariakit.org/guide/coding-gui…
ALT Screenshot of the "Prefer interface over type" section from the page linked in the post
✨ New example: Combobox filtering
Using "React.startTransition" to ensure the UI remains responsive while typing, and the "match-sorter" library to filter the results.
You own this logic. Ariakit is only concerned with what you render.
Demo and code → ariakit.org/examples/combobo…
ALT Screenshot of the "Setting the search value" and "Filtering items" sections on the Combobox filtering page linked in the tweet
The @ariakitjs Tooltip component allows for text selection and seamlessly integrates with browser extensions such as Google Translate, all while keeping the tooltip visible.
Link in the thread 👇🏽
ALT Showing a tooltip that says "Accessibility Shortcuts", then selecting the text inside the tooltip to trigger the Google Translate popup.
The Ariakit Combobox component allows for all standard keyboard interactions when the options are rendered as <a>
Demo and code → ariakit.org/examples/combobo…
ALT Screenshot of a section of Ariakit's docs page with the following text:
Link features
When rendered as a link, ComboboxItem supports all native link behaviors, including:
Open in a new tab in the background: ⌘ Enter
Open in a new tab and switch to the tab: ⌘ Shift Enter
Open in new window: Shift Enter
Download: Alt Enter
Hide on click
To provide a better user experience, when opening the link in a new tab, the ComboboxPopover will remain open, even if the hideOnClick prop is explicitly set to true.
ALT Screenshot of Ariakit's Combobox component with links
✨ New example: Menu with Tooltip
✦ Tooltip closes when the dropdown opens
✦ Full keyboard support (Escape key just works)
✦ Tooltip is not shown on touch
→ ariakit.org/examples/menu-to…
ComboboxGroup and ComboboxGroupLabel components.
Here's an example using these components on a combobox with autoselect and inline auto-completion (optional features).
Demo and code:
ariakit.org/examples/combobo…