Skip to content
Gravity Logo / Docs Gravity home
Browse documentation
Documentation/Gravity Web

View

The View component houses global components common to all views, such as notifications and dialogs. It handles errors, sets the document title, and renders the specified layout. The view and its props are rendered by the router.

Info

Props are passed to this component automatically from the router.

Usage

import { View } from 'components/lib';
import { Dashboard } from 'views/dashboard/dashboard';

function MyApp() {
  return (
    <View
      title="Dashboard"
      layout="app"
      view={ Dashboard }
    />
  );
}

Props

PropDescriptionRequiredValue
viewview componentrequiredcomponent
layoutlayout (defaults to app)optionalstring (account/app/auth/onboarding)
titledocument titlerequiredstring

Notes

  • The View component relies on ViewContext for managing notifications, dialogs, and error handling.
  • The component uses useTranslation for internationalization and useToast for toast notifications.
  • Layouts include AppLayout, AuthLayout, AccountLayout, and OnboardingLayout.