Skip to main content
CodivDocs

View

Conditional content per audience segment — Phase 6 personalization.

Status

<View> is a stub component today. The for prop is accepted and the call site is forward-compatible, but segment-based filtering ships in Phase 6 alongside the personalization engine. Until then, only views with default set are rendered.

Target API (Phase 6)

<View for="authenticated">
  Your API key is in your dashboard.
</View>

<View for="anonymous" default>
  [Sign up](https://app.codivdocs.com/signup) to get an API key.
</View>

When Phase 6 ships, the platform will read visitor state (auth status, plan tier, cookie segments) and render the matching <View>. Until then, the second view (with default) is what every reader sees.

Common segment values

Phase 6 will support a starter set of built-in segments plus tenant-defined custom ones:

SegmentSource
anonymousVisitor not signed in
authenticatedVisitor signed in
starter, pro, businessPlan tier from auth context
admin, editor, viewerRole from auth context
Custom stringTenant-defined cookie or query param

Multiple segments

Pass an array to render content for any of several audiences:

<View for={["pro", "business"]}>
  This feature is available on Pro and Business plans.
</View>

<View for="starter" default>
  This feature is available on Pro and Business plans.
  [Upgrade](https://app.codivdocs.com/billing) to unlock it.
</View>

Why this exists

Personalized content reduces cognitive load — readers see only what applies to them. The classic use cases:

  • Authenticated vs anonymous CTAs: "Open your dashboard" vs "Sign up"

  • Plan-tier feature gates: "This is on Pro+" vs "Upgrade to access"

  • Role-specific instructions: "As an admin you can..." vs "Ask your admin to..."

v0 fallback

Today, <View default> renders and <View> without default is hidden. So you can author your pages with the target API now and they'll render correctly when Phase 6 ships — no rewrites needed.

Props

PropTypeDescription
forstring | string[]Target segment(s). Currently stored as data-view attribute for future client-side filtering.
defaultbooleanRender this view when no segment matches (or when running in stub mode)
childrenReactNodeView content

Last updated April 12, 2026