Bits UI components that render an underlying HTML element expose a ref prop, which gives you a reference to the underlying element.
For example, the Accordion.Trigger component exposes a ref prop, which gives you a reference to the HTMLButtonElement that is rendered by the component.
With delegation
Bits UI tracks the reference to the underlying element using it's id attribute. This means that even if you use a custom element/component with delegation, the ref prop will still work.
One caveat is that if you wish to use a custom id on the element, you must pass it to the component first so it can be registered and associated with the ref prop. The id you pass will be passed down via the props snippet prop on the child snippet.
The following example would not work, as the Accordion.Trigger component has no idea what the id of the CustomButton is.
WithElementRef
Bits UI exposes a WithElementRef type which enables you to create your own components following the same ref prop pattern.