easeul

Base UITransitions

Accordion

A grid row rather than a height, so the preset reads none of the four panel-height variables the two libraries publish between them.

Every value the manifest allows on this host, single presets and the pairs that compose. The first is what this component ships with. Both stages are the same component, so anything that changes between them is the attribute.

withoutno attribute

with easefuldata-motion="collapse"

host writes

data-open / data-closed, plus data-ending-style

easeful matches

[data-motion~="collapse"][data-ending-style] { grid-template-rows: 0fr }

what runs

transition: grid-template-rows 150ms

you write

<Accordion.Panel data-motion="collapse" />

Where the attribute goes

The parts this demo composes, and the value each one carries. Everything inside an animated part is that part's content, so the tree stops there.

  1. Accordion.Root
  2. Accordion.Item
  3. Accordion.Header
  4. Accordion.Trigger
  5. Accordion.Paneldata-motion="collapse"

Source

"use client"

import { Accordion } from "@base-ui/react/accordion"
import type { DemoProps } from "@/components/demos/props"

export function BaseUiAccordion({ motion }: DemoProps) {
  return (
    <Accordion.Root>
      <Accordion.Item value="one">
        <Accordion.Header style={{ margin: 0 }}>
          <Accordion.Trigger className="btn">What ships to the browser?</Accordion.Trigger>
        </Accordion.Header>
        <Accordion.Panel data-motion={motion}>
          <div className="panel" style={{ marginTop: 12 }}>
            <p className="panel__body">
              CSS only. The panel is a grid with one row, and the child inside it is the clip.
            </p>
          </div>
        </Accordion.Panel>
      </Accordion.Item>
    </Accordion.Root>
  )
}
The whole file, read from disk at build time. Both copies above render from it, and the motion prop is the only difference between them.