MDK Logo

Filter

Filter controls, filter bars, and search filters

Components for filtering and searching data.

Prerequisites

  • Install the packages
npm install \
  @tetherto/mdk-react-devkit \
  @tetherto/mdk-react-adapter \
  @tetherto/mdk-ui-foundation
  • Import styles: import '@tetherto/mdk-react-devkit/styles.css'

Components

@tetherto/mdk-react-devkit

Import the public APIs on this page from @tetherto/mdk-react-devkit.

ListViewFilter

Toolbar of dropdown/checkbox filters that drive a list view; emits the active filter set to the parent

agent-ready

Source

src/primitives/components/list-view-filter/USAGE.md

src/primitives/components/list-view-filter/index.tsx

Props

PropStatusType / OptionsDefaultDescription
onChangeRequired(selections: CascaderValue[]) => void-Callback when filters change
optionsRequiredCascaderOption[]-Cascader options for filtering
classNameOptionalstring-Custom className for the filter button
filterKeyOptionalstring"default"Optional key to force re-mounting the Cascader when filters change Useful if you want to reset the internal state of the Cascader when filters change
localFiltersOptionalLocalFilters-Current filter values as key-value pairs Example: { type: 'Antminer S19XP H', status: ['active', 'pending'] }

PeriodControl

Reporting-period control: a rolling preset or a custom day range, the buckets the page aggregates into (a bucket that does not fit the range is disabled), and Reset. Pair it with usePeriod, which keeps the period in the URL

agent-ready

Source

src/domain/components/timeframe/period-control/USAGE.md

src/domain/components/timeframe/period-control/period-control.tsx

Props

PropStatusType / OptionsDefaultDescription
stateRequiredPeriodState-The period to show and change, from usePeriod
timezoneRequiredstring-The site's timezone, in which custom ranges are whole days
classNameOptionalstring-Additional class for the root element
showGranularityOptionalbooleantrueShow the bucket toggle. Hide it on a page that shows one figure per period

ReportTimeFrameSelector

Reporting-period selector with preset windows (1d / 7d / 30d / custom range)

agent-ready

Source

src/domain/components/timeframe/report-time-frame-selector/USAGE.md

src/domain/components/timeframe/report-time-frame-selector/report-time-frame-selector.tsx

Props

PropStatusType / OptionsDefaultDescription
dateRangeRequired[Date, Date]-Custom date range as a [start, end] tuple
presetTimeFrameRequirednumber | null-Selected preset in days (1, 7, 30); null means the custom range is active
setDateRangeRequired(value: [Date, Date]) => void-Update the custom date range
setPresetTimeFrameRequired(value: number | null) => void-Update the preset selection

TimeframeControls

Date-range picker for financial reporting pages — supports year, month, and week granularity via connected selects

agent-ready

Source

src/domain/components/timeframe/timeframe-controls/USAGE.md

src/domain/components/timeframe/timeframe-controls/timeframe-controls.tsx

Props

PropStatusType / OptionsDefaultDescription
dateRangeOptionalTimeframeControlsDateRange-Current date range
hintOptionalstring-Helper text below the controls
isMonthSelectVisibleOptionalbooleantrueShow month selector
isWeekSelectVisibleOptionalbooleantrueShow week selector
layoutOptional"horizontal" | "stacked""horizontal"Layout direction
onRangeChangeOptionalTimeframeControlsOnRangeChange-Called when the range changes
onResetOptionalVoidFunction-Called when the Reset button is clicked
onTimeframeTypeChangeOptional(type: TimeframeTypeValue) => void-Called when timeframe type changes
showResetButtonOptionalbooleanfalseShows the Reset button
timeframeTypeOptionalnull | "month" | "week" | "year"-Active timeframe type
TimeframeControlsDateRange
PropStatusType / OptionsDefaultDescription
endRequirednumber-Range end (epoch ms); matched with start against calendar weeks to restore a week selection
startRequirednumber-Range start (epoch ms); the year/month/week pickers sync to this date

TimeframeWeekFlatContent

Flat list of selectable week items for the TimeframeControls week selector

agent-ready

Source

src/domain/components/timeframe/timeframe-controls/USAGE.md

src/domain/components/timeframe/timeframe-controls/timeframe-controls-week-content.tsx

Props

PropStatusType / OptionsDefaultDescription
visibleWeeksRequiredWeek[]--
Week
PropStatusType / OptionsDefaultDescription
bucketMonthRequirednumber-Month (0-11) of the week's end date in the selected timezone; sent as month to onRangeChange
bucketYearRequirednumber-Year of the week's end date in the selected timezone; sent as year to onRangeChange
endRequiredDate-Sunday 23:59:59.999 (local time) that closes the week, capped to the end of yesterday
labelRequiredstring-Option text, DD/MM - DD/MM in the selected timezone
startRequiredDate-Monday 00:00:00.000 (local time) that opens the week
disabledOptionalboolean-True when the week starts after the end of yesterday; the option is shown but not selectable

TimeframeWeekTreeContent

Hierarchical year → month → week tree for the TimeframeControls week selector

agent-ready

Source

src/domain/components/timeframe/timeframe-controls/USAGE.md

src/domain/components/timeframe/timeframe-controls/timeframe-controls-week-content.tsx

Props

PropStatusType / OptionsDefaultDescription
selectedMonthRequirednumber--
selectedYearRequirednumber--
timezoneRequiredstring--

On this page