• Docs
  • Blog
    • 0.25.1

    • light

      dark

      system

      Switch mode
    • Cerberus

      Acheron

      Elysium

    Get Started
    Components
    Styling
    Theming

    Concepts

    OverviewCompositionTesting

    Layout

    Aspect RatioBleedBoxCenterContainerDividerFlexFloatGridLink OverlayScrollableStackWrap

    Components

    AccordionAdmonitionAvatarButtonCarouselCheckboxClipboardCollapsibleComboboxConfirm ModalCTAModalDate PickerDialogFieldFieldsetFile UploaderIcon ButtonInputLoading StatesMenuNotificationsNumber InputPin InputProgressPrompt ModalRadioRatingSelectSplit ButtonSwitchTableTabsTagTextTextareaToggleTooltip

    Utilities

    Client OnlyDownload TriggerEnvironmentFeature FlagsFocus TrapForFormat ByteFormat NumberFormat Relative TimeFrameHighlightJSON Tree ViewLocaleLocal StoragePortalPresenceShowsplitPropsTheme

    Client Only

    Renders children only on the client side.

    • npm
    • Ark

    Motivation

    The ClientOnly component renders its children only on the client side. This is useful for components that need to access the DOM or browser APIs that are not available on the server side.

    Examples

    Basic

    import { ClientOnly } from '@cerberus/react'
    export const Basic = () => (
    <ClientOnly>
    <div>This content is only rendered on the client side.</div>
    </ClientOnly>
    )

    With Fallback

    import { ClientOnly } from '@cerberus/react'
    export const WithFallback = () => (
    <ClientOnly fallback={<div>Loading on the server...</div>}>
    <div>This content is only rendered on the client side.</div>
    </ClientOnly>
    )

    API Reference

    Component API Reference

    PropTypeRequiredDescription
    fallbackanyNoShows value when rendering on the server side

    On this page

    • Edit this page on Github
    Cerberus Design System | Docs