@dxos/react-ui
    Preparing search index...

    Function composable

    • Factory for composable (leaf) components. The implementation receives full HTMLAttributes<E> so it can destructure role, style, etc. Consumers see only ComposableProps<P> — a narrow type exposing classNames, className, children, and the custom props P.

      For generic components, use any for the type parameter inside composable and cast the result to restore the generic signature for consumers.

      Type Parameters

      • E extends HTMLElement
      • P extends object = {}

      Parameters

      • render: (
            props: Omit<P, "className"> & { classNames?: ClassNameValue } & Pick<
                HTMLAttributes<Element>,
                "role" | "children" | "style",
            > & HTMLAttributes<E>,
            forwardedRef: ForwardedRef<E>,
        ) => ReactNode

      Returns ForwardRefExoticComponent<
          Omit<P, "className"> & { classNames?: ClassNameValue } & Pick<
              HTMLAttributes<Element>,
              "role" | "children" | "style",
          > & RefAttributes<E>,
      >

      const Leaf = composable<HTMLButtonElement>(({ children, ...props }, forwardedRef) => {
      return (
      <button {...composableProps(props, { classNames: 'btn' })} ref={forwardedRef}>
      {children}
      </button>
      );
      });