Skip to main content

React

Primus UI for React

Primus UI React package usage.

Install the React package:

npm install primus-react-ui

Basic usage​

import { PrimusLogin } from "primus-react-ui";

export default function LoginPage() {
return <PrimusLogin showEmailLogin socialProviders={["azure", "auth0", "google"]} />;
}
import { PrimusProvider, PrimusLogin, usePrimusAuth } from "primus-react-ui";

function App() {
return (
<PrimusProvider authority="https://api.yourdomain.com" authBasePath="/api/auth" clientId="my-app">
<LoginPage />
</PrimusProvider>
);
}

function LoginPage() {
const { login } = usePrimusAuth();
return (
<PrimusLogin
showEmailLogin
socialProviders={["azure", "auth0", "google"]}
onLogin={({ username, password }) => login({ email: username, password })}
/>
);
}

If your backend exposes /auth/* instead of /api/auth/*, set authBasePath="/auth" and authEndpoint="/auth".

React component usage (one by one)​

AI Copilot​

<AICopilot apiUrl="https://api.yourdomain.com" />

Login​

<PrimusLogin showEmailLogin socialProviders={["azure", "auth0", "google"]} />

User Profile​

<UserProfile />

Notification Center​

<PrimusNotificationCenter apiUrl="https://api.yourdomain.com" />

Notification Feed​

<NotificationFeed />

Security Dashboard​

<SecurityDashboard apiUrl="https://api.yourdomain.com" />

RBAC Admin​

<PrimusRbacAdmin
apiUrl="https://api.yourdomain.com"
authToken={() => localStorage.getItem("access_token")}
defaultScope={{ applicationId: "app-core", tenantId: "tenant-001" }}
withCredentials
title="RBAC Admin"
subtitle="Roles, permissions, teams, and access checks"
/>

The RBAC Admin UI expects the RBAC endpoints described in the backend integration guide: /docs/modules/rbac/integration-guide.

Document Viewer​

<DocumentViewer
document={{ id: "doc-1", name: "Invoice", type: "pdf", url: "/sample.pdf" }}
onDownload={() => {}}
/>

Checkout Form​

<CheckoutForm amount={499} currency="USD" apiUrl="https://api.yourdomain.com" />

File Uploader​

<FileUploader apiUrl="https://api.yourdomain.com" onUploadComplete={() => {}} />

Feature Flag Toggle​

<FeatureFlagToggle apiUrl="https://api.yourdomain.com" />

Data Table​

<PrimusDataTable columns={columns} data={rows} />
<PrimusModal open={isOpen} title="Confirm" onClose={() => setIsOpen(false)}>
Modal content
</PrimusModal>

Dashboard​

<PrimusDashboard title="Overview" subtitle="Key metrics" />

Activity Feed​

<PrimusActivityFeed items={activityItems} />

Filter Bar​

<PrimusFilterBar filters={filters} activeFilters={activeFilters} onChange={setFilters} />

Export Menu​

<PrimusExportMenu formats={['CSV', 'PDF']} onExport={(payload) => console.log(payload)} />

Charts​

<PrimusLineChart labels={labels} series={series} height={320} />

Date Range Picker​

<PrimusDateRangePicker ranges={['Today', 'Last 7 days']} onRangeChange={(range) => console.log(range)} />
<PrimusSearch placeholder="Search users" onSearch={(value) => console.log(value)} />
<PrimusHeader title="Primus Admin" breadcrumbs={breadcrumbs} user={currentUser} />
<PrimusSidebar items={navItems} activeId={activeId} />

Layout​

<PrimusLayout sidebar={<PrimusSidebar items={navItems} />} header={<PrimusHeader title="Primus" />}>
App content
</PrimusLayout>

Transaction History​

<TransactionHistory transactions={transactions} />

Account Dashboard​

<AccountDashboard apiUrl="https://api.yourdomain.com" />

Credit Score Card​

<CreditScoreCard userId="user-123" apiUrl="https://api.yourdomain.com" />

Loan Calculator​

<LoanCalculator apiUrl="https://api.yourdomain.com" />

KYC Verification​

<KYCVerification userId="user-123" apiUrl="https://api.yourdomain.com" />

Credit Card Visual​

<CreditCardVisual cardHolder="Jane Doe" last4="4242" expiry="12/26" brand="visa" />

Quote Comparison​

<QuoteComparison apiUrl="https://api.yourdomain.com" />

Premium Calculator​

<PremiumCalculator apiUrl="https://api.yourdomain.com" />

Policy Card​

<PolicyCard
policyNumber="POL-123"
coverageAmount={250000}
premiumAmount={120}
status="Active"
type="Auto"
/>

Claim Status Tracker​

<ClaimStatusTracker
claimId="CLM-123"
steps={[
{ id: "submitted", label: "Submitted", status: "completed" },
{ id: "review", label: "Review", status: "current" },
{ id: "approved", label: "Approved", status: "upcoming" }
]}
/>

Fraud Detection Dashboard​

<FraudDetectionDashboard apiUrl="https://api.yourdomain.com" />

Agent Directory​

<AgentDirectory apiUrl="https://api.yourdomain.com" />

Log Viewer​

<LogViewer />

Button​

<Button>Primary</Button>

Input​

<Input label="Email" placeholder="name@example.com" />

Props reference (all components)​

React props reference​

AICopilot​

PropDescription
apiUrlBase API URL for network calls.

AccountDashboard​

PropDescription
apiUrlBase API URL for network calls.

AgentDirectory​

PropDescription
apiUrlBase API URL for network calls.

Button​

No custom props. Inherits standard element props if applicable.

CheckoutForm​

PropDescription
amountAmount value.
apiUrlBase API URL for network calls.
currencyCurrency code.
onErrorEmits error string.
onSuccessEmits success response.

ClaimStatusTracker​

PropDescription
claimIdClaim identifier.
stepsStep definitions.

CreditCardVisual​

PropDescription
brandBrand name.
cardHolderCardholder name.
expiryExpiry date.
last4Last four digits.
variantStyle variant.

CreditScoreCard​

PropDescription
userIdUser identifier.

DocumentViewer​

PropDescription
documentDocument payload to preview.
onCloseEmits when closed.
onDownloadEmits when download requested.

FeatureFlagToggle​

PropDescription
apiUrlBase API URL for network calls.

FileUploader​

PropDescription
apiUrlBase API URL for network calls.

FraudDetectionDashboard​

PropDescription
apiUrlBase API URL for network calls.

Input​

No custom props. Inherits standard element props if applicable.

KYCVerification​

PropDescription
userIdUser identifier.

LoanCalculator​

PropDescription
apiUrlBase API URL for network calls.

LogViewer​

PropDescription
apiUrlBase API URL for network calls.

NotificationFeed​

No custom props. Inherits standard element props if applicable.

PolicyCard​

PropDescription
coverageAmountCoverage amount.
nextPaymentDateNext payment date.
policyNumberPolicy number.
premiumAmountPremium amount.
statusStatus value.
typeType or category.

PremiumCalculator​

PropDescription
apiUrlBase API URL for network calls.

PrimusDashboard​

PropDescription
actionsAction slot content.
childrenDashboard content.
subtitleSecondary heading text.
titlePrimary heading text.

DashboardGrid​

PropDescription
childrenGrid content.
columnsColumn count (1-4).

PrimusStatCard​

PropDescription
titleCard title.
valueValue text.
changeChange badge configuration.
iconLeading icon.
descriptionSupporting text.
trendSparkline data values.

PrimusDataTable​

PropDescription
actionsAction items or configuration.
columnsColumn configuration.
dataData payload.
emptyMessageEmpty state text.
loadingLoading state.
onRowClickEmits row data on click.
onSelectionChangeEmits selected keys.
rowKeyUnique key field for rows.
searchPlaceholderSearch input placeholder.
searchableEnable search box.
selectableEnable row selection.
selectedKeysSelected row keys.
paginatedEnable client-side pagination.
pageSizePage size when paginated.
pageIndexControlled page index.
onPageChangeEmits page changes.

PrimusHeader​

PropDescription
actionsAction items or configuration.
avatarAvatar URL.
breadcrumbsBreadcrumb items.
emailEmail address.
nameForm field name.
onUserClickCustom property.
titlePrimary heading text.
userUser info.

PrimusLayout​

PropDescription
childrenChildren content.
darkModeEnable dark mode.
headerHeader content or toggle.
sidebarSidebar content or toggle.

PrimusLogin​

PropDescription
authEndpointAuth base endpoint.
logoLogo URL.
onLoginEmits login payload.
onSocialLoginEmits provider selection.
showEmailLoginShow email/password form.
socialProvidersEnabled social providers.
subtitleSecondary heading text.
themeTheme override.
titlePrimary heading text.

PrimusModal​

PropDescription
childrenChildren content.
footerFooter content.
onCloseEmits when closed.
openOpen state.
sizeSize variant.
titlePrimary heading text.

PrimusNotificationCenter​

PropDescription
apiUrlBase API URL for network calls.
themeTheme override.
pollIntervalPolling interval in ms.
mockDataMock notification list.
useMockToggle mock mode.

PrimusRbacAdmin​

PropDescription
apiUrlBase API URL (origin only).
authTokenBearer token or resolver.
headersExtra headers for requests.
withCredentialsInclude cookies + CSRF header for BFF auth.
endpointsOverride RBAC endpoints.
defaultScopePre-fill scope fields.
defaultPrincipalTypeDefault principal type (e.g., user).
defaultGroupTypeDefault group type (e.g., team).
showScopeFieldsToggle scope fields.
titlePrimary heading text.
subtitleSecondary heading text.
showHeroShow the left hero panel (default: true).
heroBadgeHero badge label.
heroTitleHero headline text.
heroSubtitleHero supporting text.
heroItemsHero bullet list items.

PrimusActivityFeed​

PropDescription
itemsActivity items.
maxItemsMaximum items to display.
showTimestampsToggle timestamp labels.
groupByDateGroup items by date.
loadingLoading state.

PrimusFilterBar​

PropDescription
filtersFilter configuration list.
activeFiltersCurrent filter values.
onChangeEmits filter changes.
childrenOptional actions or extra content.

PrimusExportMenu​

PropDescription
formatsExport format list.
includeChartsInclude charts toggle.
includeStatsInclude stats toggle.
includeTablesInclude tables toggle.
onExportEmits export payload.

PrimusSearch​

PropDescription
placeholderPlaceholder text.
debounceDebounce delay in ms.
valueControlled value.
showSuggestionsToggle suggestions list.
suggestionsSuggestion list.
onSearchEmits search query.

PrimusDateRangePicker​

PropDescription
startDateStart date value.
endDateEnd date value.
rangesPreset ranges.
minMinimum date.
maxMaximum date.
disabledDisable inputs.
onRangeChangeEmits range changes.

PrimusLineChart / PrimusAreaChart / PrimusBarChart / PrimusPieChart / PrimusSparkline​

PropDescription
labelsX-axis labels.
seriesSeries list.
dataChart.js data object override.
optionsChart.js options override.
heightChart height in px.
widthChart width in px.
legendToggle legend.
responsiveResponsive sizing.
maintainAspectRatioKeep aspect ratio.
ariaLabelAccessible label.

PrimusSidebar​

PropDescription
activeIdActive navigation id.
footerFooter content.
itemsNavigation items (supports href, route, target).
logoLogo URL.
onItemClickCustom property.

QuoteComparison​

PropDescription
apiUrlBase API URL for network calls.

SecurityDashboard​

PropDescription
apiUrlBase API URL for network calls.

TransactionHistory​

PropDescription
onTransactionClickEmits selected transaction id.
transactionsTransaction list.

UserProfile​

No custom props. Inherits standard element props if applicable.

Notes:

  • React Button and Input extend native element attributes; use standard props as needed.
  • Props listed here are inferred from component definitions.

Notes:

  • React Button and Input extend native element attributes; use standard props as needed.
  • Props listed here are inferred from component definitions.
Primus SaaS UI Components

@primus/ui-core is the zero-dependency base layer that powers all component styling. It provides design tokens, semantic HTML element styles, and Web Components (<primus-tabs>, <primus-dropdown>, toast API) that work in React, Angular, and plain HTML.

Add it once and all your HTML elements inherit the Primus purple brand palette automatically:

npm install @primus/ui-core

Full reference →