Skip to content
Docs
Composition

Composition

Each and every atomic components in our library supports Ariakit's Composition

Atomic components are put together into a single complex component in most of the components. Inorder to customize the behavior of this complex component, we provide two ways to customize it as per the needs.

  • Simple Composition
  • Advanced Composition

Let's take the Checkbox component to explain the composition.

Basic Usage

Simple Composition

Directly pass the atomic components specific to its complex component as childrens or as render prop.

Without state as childrens

With State as render prop

Advanced Composition

Only compose using the atomic components specific to its complex component separately with the help of useComponentProps & useComponentState.

Using useComponentProps

Basic usage that can be used to add additional DOM elements within these atomic components but cannot change the state or the libraries behavior.

Using useComponentState

Advanced usage that uses the only the Component State to change the behavior of the component that is different from library logic.

Last updated on July 20, 2022