Skip to contents

Utils

CSP Provider

Configures CSP-related behavior for inline tags rendered by Base UI components.

Outline
  • Keywords: Base UI CSP Provider, Content Security Policy, CSP nonce, React CSP, Inline script nonce, Inline style nonce
  • Sections:
    • Anatomy
    • Supplying a nonce
    • Disable inline style elements
    • Inline style attributes
    • API reference

Read more

Direction Provider

Enables RTL behavior for Base UI components.

Outline
  • Keywords: Base UI Direction Provider, React RTL Context, Text Direction Hook, useDirection Base UI, Headless RTL Components, Internationalization, i18n, Bidirectional Text, Locale Support, Arabic Hebrew Support, LTR RTL Switch
  • Sections:
    • Anatomy
    • API reference
    • useDirection
      • Return value

Read more

mergeProps

A utility to merge multiple sets of React props.

Outline
  • Sections:
    • How merging works
      • Preventing Base UI’s default behavior
    • Passing a function instead of an object
    • API reference
      • mergeProps
      • mergePropsN

Read more

useRender

Hook for enabling a render prop in custom components.

Outline
  • Keywords: Base UI useRender, React Render Prop Hook, Merge Props Helper, Merge Refs Hook, Radix asChild Migration, Component Composition, Props Spreading, Ref Forwarding, Custom Components, asChild Pattern, Slot Pattern
  • Sections:
    • Examples
    • Merging props
    • Merging refs
    • TypeScript
    • Migrating from Radix UI
    • Render prop and polymorphism
    • API reference
      • Input parameters
      • Return value

Read more