All notable changes to this project will be documented in this file.
See the Changesets for the latest changes.
- ColorPicker:
- Fix issue where entering empty value in alpha sets value to
NaN. Now, it reverts back to the previous alpha value - Fix issue where channel inputs within control and content have similar ids, violating the accessibility tree
- Fix issue where entering empty value in alpha sets value to
- Select: Fix issue where
collectionis not returned in theapi - React: Refactor types to reference react
usedirectly - DatePicker: Fix issue where
api.isOpenreturnedundefinedin some cases
- RadioGroup: Set default orientation to
vertical
- Slider: Rename
outputpart tovalueTextto match naming convention - DatePicker
- Remove support for
inlinein datepicker and replace withcloseOnSelectfor API consistency. - Add
data-placementto trigger and content parts for position-aware styling.
- Remove support for
-
ColorPicker
- Fix issue where channel inputs within control doesn't get synced
- Fix issue where area selection doesn't work when the value is not
hsl - Add default
12pxsize for transparency grid
-
RadioGroup: Fix issue where indicator stays visibile when the value is
null -
Combobox: Fix issue where combobox positioner is
hiddenwhen combobox is not open
-
Toast: Redesign toast render apis to allow for framework control.
defaultOptionscan now be passed directly to thetoast.groupmachine context.- You can now pass the default
renderfunction to thetoast.groupmachine context. - Removed
api.renderin favor of userland control. This eliminates the bug in Solid.js for custom toasts.
-
Carousel: Rename
onSlideChangetoonIndexChange -
Slider, RangeSlider: Merge the slider and range slider machines into one to prevent logic duplication.
valueandonValueChangetype has been updated to benumber[]- Update
api.getThumbProps(index)toapi.getThumbProps({ index })
-
Dialog: Rename dialog container to dialog positioner for better API consistency. This means
api.containerPropsis nowapi.positionerProps
- FileUpload: Issue where
api.setFilesandapi.clearFilesdoes not work - NumberInput: Fix issue where before input gets called with incorrect event data
- Popover: Fix issue where popover shows a
DOMExceptionwarning when third party iframes are present
- DatePickcer: Add new table head component to allow for customizing the table head
💥 Breaking changes
-
Combobox, Select, HoverCard: Rename
api.setPositioning(...)toapi.reposition(...) -
Carousel: Refactor components to ensure consistent naming convention
slideGroupProps->itemGroupPropsgetSlideProps->getItemPropsnextSlideTrigger->nextTriggerprevSlideTrigger->prevTrigger
-
ColorPicker:
- Redesigned components to ensure consistent naming convention
- Added support for trigger and content parts to control the open/close behavior
- Add new
api.getChannelValueAPI to get the value of a specific color channel
-
Pagination: Rename component anatomy and parts
getPageTriggerProps=>getTriggerPropsgetNextPageTriggerProps=>getNextTriggerPropsgetPrevPageTriggerProps=>getPrevTriggerProps
- All Machines: Ensure
diris applied to all positioner elements - FileUpload: Fix reopening the system file picker in file-upload on browsers other than Chrome
- PinInput: Fix issue where multiple values can be entered in a single input
💥 Breaking changes
-
FileUpload:
- Redesign the file-upload component to include new parts:
Item: The element that represents a fileItemSizeText: The element that represents the size of a fileItemName: The element that represents the name of a fileItemDeleteTrigger: The buttonelement used to delete a file
- Added new
api.getFileSizemethod to get the size of a file in a human readable format
- Redesign the file-upload component to include new parts:
-
RatingGroup:
- Rename
api.sizeArraytoapi.items - Rename
maxtocount
- Rename
- All machines: Ensure the
dirattribute is applied consistently across all component parts. - ColorPicker:
- Fix issue where color area changes format when you type custom hex values
- Fix issue where alpha channel input resets to 1 after blurring hex channel input
- Dialog:
- Fix issue where focusing outside closes the dialog despite
closeOnInteractOutsidebeing set tofalse
- Fix issue where focusing outside closes the dialog despite
- Editable:
- Fix issue where the input value doesn't get synced correctly when controlled
- Combobox: Add support for
api.setPositioning(...)to allow for repositioning the combobox content - Menu:
- Add new
optionItemIndicatorandoptionItemTextpart - Add
api.optionItemIndicatorProps(...),api.optionItemTextProps(...)support - Add api.getOptionItemState and
api.getItemState - Export
OptionItemStateandItemStatetypes
- Add new
- ColorPicker: Add support for entering native color names (e.g. red, blue, green, etc.)
- Menu:
- Removed
api.isOptionCheckedin favor ofapi.getOptionItemState
- Removed
- NumberInput:
- Refactor number input machine to handle number parsing correctly
- Fix issue where value doesn't listen to form reset events
- BREAKING: Removed the following context properties in favor of the new
formatOptions:validateCharacter,parse,format,minFractionDigits,maxFractionDigits
- Dialog:
- Fix issue where
modal: falsedoesn't disable focus trap - Rename
closeOnEsctocloseOnEscapeKeyDown - Rename
onEsctoonEscapeKeyDown - Rename
closeOnOutsideClicktocloseOnInteractOutside
- Fix issue where
- Editable:
- Hide submit and cancel trigger when not in editing mode
- Hide edit trigger when in editing mode
- ToggleGroup: Fix issue where anatomy was not exported
- Pagination: Fix bug where pagination returns inconsistent pages
- Select, Combobox: Fix issue where
readonlyitems could not be used in the collection - Focus Visible: Fix issue where focus visible was not working when clicked inside element with
tabindexattribute - Toast: Fix accessibility issue where toast placement region labels were not unique
- Menu: Fix issue where menu does not scroll highlighted item into view
- Add indicator part to some components for ease of styling. Added
AccordionItemIndicator,SelectIndicator,MenuIndicator,PopoverIndicator
- Popper: Ensure positioner uses the same
zIndexas the content element
💥 Breaking changes
-
Refactor component anatomy to use consistent naming convention across all machines.
-
Accordion
getTriggerProps=>getItemTriggerPropsgetContentProps=>getItemContentProps
-
Radio
getRadioProps=>getItemPropsgetRadioControlProps=>getItemControlPropsgetRadioLabelProps=>getItemTextPropsgetRadioHiddenInputProps=>getItemHiddenInputPropsgetRatingState=>getItemStategetRatingProps=>getItemProps
-
TagsInput
getTagProps=>getItemPropsgetTagDeleteTriggerProps=>getItemDeleteTriggerPropsgetTagInputProps=>getItemInputProps
-
Toggle Group
getToggleProps=>getItemProps
-
-
ToggleGroup: Allow deselecting item when
multipleisfalse.
- Pagination: Fix issue where change callback does not get called when clicking the page button.
- DatePicker: Add
onOpenChangecallback to listen for changes in the open state - [New]: Add
@zag-js/file-utilspackage to help with file related operations - Editable: Autofocus the editable input element when
startsWithEditViewis set totrue - Tabs: Add
api.getTriggerState(...)to get the current state of the tab trigger
💥 Breaking changes
-
All machines: Unify all callbacks to follow a consistent naming convention
onOpenandonClose=>onOpenChangeonChange=>onValueChangeonFocus=>onFocusChangeonHighlight=>onHighlightChangeonLoadandonError=>onLoadingStatusChangeonInputChange=>onInputValueChange
-
Remove toggle machine in favor of userland implementation. For more advanced toggle functionality, use the
ToggleGroupmachine. -
RadioGroup: Remove
api.blur()from radio group machine. Prefer to usedocument.activeElement.blur()instead. -
FileUpload
- Rename
api.setValuetoapi.setFiles - Rename
api.clearValuetoapi.clearFiles
- Rename
-
Tabs: Changed
api.setIndicatorRect(id)toapi.setIndicatorRect(value)for better userland control
- All machines: Fix issue where onChange callbacks could be executed excessively when no value changed.
- Combobox, Select:
- Fix issue where clear trigger was incorrectly shown when value is empty
- Export
CollectionItemtype - Ensure consistent usage of generics across the
connectandmachinefunctions
-
Popper: Fix issue where passing the
offsetpositioning option to popper-related components causes undesired placement in each render cycle. -
RadioGroup: Fix issue where change event doesn't get dispatched when value changes programmatically.
- Combobox, Selected
- Add
controlandrootparts to select and combobox components
- Add
-
Combobox, Select
- Loosen the collection item types to allow string item
- Add generic to select and combobox context and api
- Use dismissable layer to better manage layering when used in a popover or dialog
-
Checkbox, Switch: Dispatch change event when checked state is set programmatically to get it working in Solid.js form libraries
- DatePicker
- Fix issue where datepicker value
onChangereturned a proxy array - Fix issue where clearing the date picker value prevent selecting a new date when
inline: trueis set
- Fix issue where datepicker value
- Menu: Fix issue where
closeOnSelecton menu item props isn't respected in machine - NumberInput: Fix issue where number input goes into infinite update cycles due to additional input event
- React: Export
PropTypesfrom react package for consistency - Select, Combobox: Add support for selecting multiple items
- Combobox: Add support for
closeOnSelect
- RadioGroup: Remove unsupported
readOnlyproperty from types
💥 Breaking changes
Redesign select and combobox API to allow passing value as string and collection
Prior to this change, Zag computes the label and value from the DOM element. While this worked, it makes it challenging
to manage complex objects that don't match the label and value convention.
// Create the collection
const collection = select.collection({
items: [],
itemToString(item) {
return item.label
},
itemToValue(item) {
return item.value
},
})
// Pass the collection to the select machine
const [state, send] = useMachine(
select.machine({
collection,
id: useId(),
}),
)-
React: Fix issue where spreading props on a
forwardRefelement show aLegacyReferror -
Slider: Fix issue where slider marks are not aligned to the thumb position in "contain" alignment mode
-
TagsInput: Ignore key during composition in
onKeyDownevent -
Combobox, Select, Menu
- Fix issue where select clicks underlying element on mobile.
- Fix issue where combobox and menu option item triggers double click.
-
Form Elements: Re-enable the input after removing
disabledattribute from the parent fieldset
- Slider: Add support for passing the
thumbSizein the machine context to avoid first-render flicker due to DOM measurement.
💥 Breaking changes
- All machines: Rename exported
PublicApitoApi - Combobox: Remove
selectInputOnFocusoption in favor of userland control - Accordion: Remove support for passing
valueasstring. Thevalueproperty must be an array of stringsstring[] - Tabs
- Rename
onHighlighttoonFocusChange - Remove
onTagUpdate, useonChangeinstead
- Rename
- Select: Fix issue where interaction outside and positioning does not work when select content is conditionally rendered
- Pressable: Remove
idusage for better composition - Radio: Rename
getRadioInputPropstogetRadioHiddenInputProps - Tabs: Rename
tablistpart tolistto match naming convention
- Checkbox: Rename
inputPropstohiddenInputProps - All machines: Remove
hiddenInputfrom machine anatomy - Combobox: Add
optionGroupLabelpart to Combobox - Tabs: Remove content group part
- Dialog: Improve outside interaction logic to avoiding closing when interacting with browser extensions like grammarly or 1password.
- File Upload
- Rename
minSizeandmaxSizetominFileSizeandmaxFileSizerespectively - Rename
api.openFilePickertoapi.open
- Rename
💥 Breaking changes
- Carousel: Rename
nextTrigger,prevTriggertonextSlideTriggerandprevSlideTriggerparts - DatePicker: Add positioner part to allow dynamic positioning
- Combobox, Editable, Menu, Select, TagsInput: Provide interaction event handlers (
onPointerdownOutside,onFocusOutsideandonInteractOutside) to better manage outside interaction
- ColorPicker
- Fix issue where
isEqualdoesn't consider alpha channel. - Fix keyboard navigation in Color Picker between area and channel slider thumb.
- Fix issue where
- Popper Components
- Fix issue in Combobox, Select, Menu, Hover Card where
sameWidthdoesn't work consistently during re-render.
- Fix issue in Combobox, Select, Menu, Hover Card where
- File Upload: Add
data-disabledto all element parts - NumberInput: Add
data-focusto all element parts - Popover: Set
portalledattribute to betrueby default - RadioGroup:
- Add
data-orientationto all parts - Remove unimplemented
setPreviousValueaction
- Add
-
Core: Add support for transforming context before settings it in the machine's context. This is useful when some values need to passed to
reffunction -
Toast: Add option to set toast default options like
placement,removeDelay,duration, etc
- New ToggleGroup machine
- Avatar: Fix issue where avatar doesn't show fallback when image src is initially empty
- ColorPicker: Fix issue where focusing on area thumb doesn't transition to focused state, making keyboard navigation not work.
- Checkbox, Switch: Fix issue where
api.setCheckeddoes not work
💥 Breaking changes
-
All machines:
-
Add
data-stateattribute to allow styling the open/closed state or checked/unchecked states -
We replaced
data-expandedordata-checkedtodata-stateattributedata-expandedmaps todata-state="open"ordata-state="closed"data-checkedmaps todata-state="checked"ordata-state="unchecked"data-indeterminatemaps todata-state="indeterminate"data-openmaps todata-state="open"
-
- All machines: Fix issue where machine types were not being properly inferred
- Carousel: Expose the types and add
onClickto carousel indicator - ColorPicker: Fix types exports
- Editable: Fix issue where initially cancelling the value by pressing the escape key doesn't work
- Tooltip: Fix issue where it re-opens after clicking the trigger and moving the cursor slightly
- Tooling: Revert build tooling from
vitetotsup
- New presense machine to manage mount/unmount animation.
- All machines: Fix an issue where type declarations aren't inferred correctly
- RadioGroup: Fix issue where indicator part does not transition its size and position after first render
- All machines: Improve DOM detection code to rely on
documentinstead ofwindow - Popper: Fix issue where
offsetis ignored from default gutter
- Avatar: Fix issue where anatomy was not exported
- Splitter: Set the panel's default
minSizeto0
- Splitter: Fix issue where
apifor controlling panel sizes wasn't implemented
- Checkbox, Switch: Fix issue where root element emits
onClicktwice when parent element is clicked - Combobox
- Fix issue where entering value in between input character moves cursor to the end
- Fix issue where non-ascii characters could not be entered
- DatePicker, Dialog
- Fix scroll hijacking issue during initial and return focus
- Upgrade
focus-trappackage to ensure that trap works when the active element within the content is removed - Fix scroll hijacking issue during initial and return focus
- Pressable: Ensure consistent behavior between space and enter key
- Anatomy: Update
createAnatomyto return an array of the anatomy instance's part names
- New Avatar machine
- All machines: Fix issue where event point calculation is incorrect when the page is scrolled
- Dialog: Fix issue where
setReturnFocusused infocus-trapthrows a console error - PinInput: Fix issue where
defaultValueis always overriden with an array with empty strings when mounted
- DatePicker: Fix inconsistencies in api methods and naming conventions
- Switch: Remove unused attributes and make it consistent with checkbox
- Tabs
- Remove unneeded style property in the indicator (depending on orientation)
- Fix bug where keyboard navigation doesn't work in manual activation mode
- Anatomy: Add support for renaming component scope/name
- All machines:
Ensure ids of underlying elements can customized based onids` context property. - Editable: Fix issue where focus is hijacked on blur when interacting outside on a focusable element
- Core: Refactor regex for
mergePropsin zag core. - Solid.js: Improve reactivity of
mergePropsfunction - Carousel: Improve support for spacing and slides per view
- ColorPicker: Export types for color channel and swatch parts
- Popover, Menu, Tooltip, HoverCard
- Update the
setPositioningapi method to allow empty arguments
- Update the
- Slider, RangeSlider: Ensure consistent props for marker
- Splitter: Export types for panel and resize trigger props
- Editable: Add
finalFocusElto allow for better return focus management - Pagination: Add
typeproperty to the pagination's context to control properties used in trigger element
- Vue: Fix issue where
defaultValuedoes not get applied to input element - Checkbox: Fix issue where checkbox
toggleCheckedwas not defined - DatePicker
- Fix issue where
focusedValuewas not synced withvalueproperty - Fix issue where input value was not updated when
localeandvaluechanged
- Fix issue where
- RatingGroup, Splitter
- Update point calculations based on changes in
getRelativePointPercentoutput
- Update point calculations based on changes in
- Rename HoverCard and Popover
onOpenChangetoonOpenandonClose
- New ColorPicker machine
- All machines: Ensure all packages are versioned together
- Checkbox: Remove the
defaultCheckedproperty in favor of thecheckedproperty that can now be controlled.
// the checkbox will be checked initially
const [state, send] = useMachine(
checkbox.machine({
id: "1",
checked: true,
}),
)
// this will update the checkbox when the `checked` value changes
const [state, send] = useMachine(checkbox.machine({ id: "1" }), {
context: {
// when this value changes, the checkbox will be checked/unchecked
checked: true,
},
})- Dialog: Remove the
defaultOpenproperty in favor of theopenproperty that can now be controlled.
// this is will open the dialog initially
const [state, send] = useMachine(dialog.machine({ id: "1", open: true }))
// this will open the dialog when the `open` value changes
const [state, send] = useMachine(dialog.machine({ id: "1" }), {
context: {
// when this value changes, the dialog will open/close
open: true,
},
})- HoverCard: Remove the
defaultOpenproperty in favor of theopenproperty that can now be controlled.
// this is will open the hoverCard initially
const [state, send] = useMachine(hoverCard.machine({ id: "1", open: true }))
// this will open the hoverCard when the `open` value changes
const [state, send] = useMachine(hoverCard.machine({ id: "1" }), {
context: {
// when this value changes, the hoverCard will open/close
open: true,
},
})- Popover: Remove the
defaultOpenproperty in favor of theopenproperty that can now be controlled.
// this is will open the popover initially
const [state, send] = useMachine(popover.machine({ id: "1", open: true }))
// this will open the popover when the `open` value changes
const [state, send] = useMachine(popover.machine({ id: "1" }), {
context: {
// when this value changes, the popover will open/close
open: true,
},
})- Switch: Remove the
defaultCheckedproperty in favor of thecheckedproperty that can now be controlled.
// the switch will be checked initially
const [state, send] = useMachine(
switch.machine({
id: "1",
checked: true,
}),
)
// this will update the switch when the `checked` value changes
const [state, send] = useMachine(switch.machine({ id: "1" }), {
context: {
// when this value changes, the switch will be checked/unchecked
checked: true,
},
})- Tooltip: Remove
defaultOpenproperty in favor of theopenproperty that can now be controlled.
// this is will open the tooltip initially
const [state, send] = useMachine(tooltip.machine({ id: "1", open: true }))
// this will open the tooltip when the `open` value changes
const [state, send] = useMachine(tooltip.machine({ id: "1" }), {
context: {
// when this value changes, the tooltip will open/close
open: true,
},
})