Skip to main content

Call logs

A paginated table of the account's calls, with a date-range filter, configurable columns and row clicks.

Usage​

TypeScript
import { CallLogs } from '@dialstack/sdk-react/call-logs';

function Dashboard() {
return <CallLogs />;
}

The table pages itself with Previous and Next controls. See Pagination.

Options​

These are specific to call logs. The common options (locale, formatting, icons, layout variant, classes, load callbacks) apply too.

React propWeb Component methodTypeDefaultDescription
dateRangesetDateRange(range){ start?: string; end?: string }—Only show calls in this range (ISO 8601 dates)
limitsetLimit(limit)number10Rows per page
displayOptionssetDisplayOptions(options)CallLogDisplayOptions—Show or hide columns (see below)
customRowRenderersetCustomRowRenderer(renderer)(call: CallLog) => string—Return your own HTML for each row
onRowClicksetOnRowClick(cb)(event: { callId; call: CallLog }) => void—Called when a row is clicked
classessetClasses(classes)CallLogsClasses—Extra CSS classes (see Styling)

Rows are CallLog records.

Date range​

end is optional and defaults to now.

TypeScript
<CallLogs dateRange={{ start: '2025-01-01', end: '2025-01-31' }} />

CallLogDisplayOptions​

OptionTypeDefaultDescription
showDatebooleantrueDate and time column
showDirectionbooleantrueInbound/outbound indicator
showFrombooleantrueFrom number
showTobooleantrueTo number
showDurationbooleantrueCall duration
showStatusbooleantrueCall status
showQualitybooleantrueCall quality (MOS) column
TypeScript
<CallLogs displayOptions={{ showQuality: false, showStatus: false }} />

Row clicks​

The event carries the call's ID and the full CallLog.

TypeScript
<CallLogs onRowClick={(event) => navigate(`/calls/${event.callId}`)} />

Custom row renderer​

Return an HTML string for each row. Escape any value you interpolate: caller names come from the caller.

JavaScript
const escape = (s) => String(s ?? '').replace(/[&<>"']/g, (c) => `&#${c.charCodeAt(0)};`);

const renderRow = (call) => `
<div class="custom-row">
<span>${call.direction === 'inbound' ? 'In' : 'Out'}</span>
<span>${escape(call.from_number)} → ${escape(call.to_number)}</span>
<span>${call.duration_seconds ?? 0}s</span>
</div>
`;

// React: <CallLogs customRowRenderer={renderRow} />
callLogs.setCustomRowRenderer(renderRow);

Styling​

classes adds your own CSS class names to parts of the component. For colors, fonts and spacing, see Theming.

KeyApplied to
loadingLoading state
errorError state
emptyThe "no calls" message
tableTable
headerTable header
rowEach row
rowInboundAn inbound call's row
rowOutboundAn outbound call's row
paginationPagination controls
TypeScript
<CallLogs classes={{ table: 'min-w-full', row: 'hover:bg-gray-50 cursor-pointer' }} />

Complete example​

TypeScript
import { useState } from 'react';
import { CallLogs } from '@dialstack/sdk-react/call-logs';

function CallLogsPage() {
const [selectedCall, setSelectedCall] = useState<string | null>(null);

const thirtyDaysAgo = new Date(Date.now() - 30 * 24 * 60 * 60 * 1000);

return (
<div className="p-4">
<h1 className="mb-4 text-2xl font-bold">Calls</h1>
<CallLogs
dateRange={{ start: thirtyDaysAgo.toISOString().split('T')[0] }}
limit={20}
layoutVariant="comfortable"
formatting={{ defaultCountry: 'US', use24HourTime: false }}
classes={{ row: 'cursor-pointer hover:bg-gray-50' }}
onRowClick={(event) => setSelectedCall(event.callId)}
onLoadError={(event) => console.error('Failed to load calls:', event.error)}
/>
{selectedCall && (
<CallDetailModal callId={selectedCall} onClose={() => setSelectedCall(null)} />
)}
</div>
);
}

Next steps​