Components expose their DOM elements through ref props, so you can focus, measure, or scroll them. Most refs come with a matching attrs prop that passes HTML attributes, such as aria-label, id, or data attributes, to the same element. The props table of each component says which element every ref points to.
import { useEffect, useRef } from 'react'import { Input } from '@nebula-kit/core' export const SearchField = () => { const inputRef = useRef<HTMLInputElement>(null) useEffect(() => { inputRef.current?.focus() }, []) return ( <Input elemRef={inputRef} ariaLabels={{ input: 'Search' }} placeholder="Search" /> )}Every ref prop accepts either a ref object as in the example above or a function. React calls the function with the element when it mounts and with null when it unmounts. This is how libraries such as react-hook-form, dnd-kit, or Floating UI hand you their refs, so you can pass them in directly.
import { Controller, useForm } from 'react-hook-form'import { Input } from '@nebula-kit/core' export const EmailField = () => { const { control } = useForm<{ email: string }>() return ( <Controller name="email" control={control} render={({ field }) => ( <Input elemRef={field.ref} value={field.value} onChange={field.onChange} /> )} /> )}elemRef and elemAttrs are the main ref and attrs of every component. They usually target the outermost element (the root div of Tabs) or the one element worth reaching (the native input of Checkbox).
When a component exposes more than one element, the other refs are named after the part they target, such as triggerRef on Reveal or toggleButtonRef on PasswordInput.