Functions reference
This guide contains a list of functions exported from Mantine packages that are not documented elsewhere.
clamp
The clamp function is exported from @mantine/hooks.
It clamps a number within the inclusive lower and upper bounds.
lowerFirst
The lowerFirst function is exported from @mantine/hooks.
It converts the first character of a string to lowercase.
upperFirst
The upperFirst function is exported from @mantine/hooks.
It converts the first character of a string to uppercase.
randomId
The randomId function is exported from @mantine/hooks.
It generates a random id with the mantine- prefix.
range
The range function is exported from @mantine/hooks.
It generates an array of numbers from start to end (inclusive).
shallowEqual
The shallowEqual function is exported from @mantine/hooks.
It performs a shallow equality check of two objects.
keys
The keys function is exported from @mantine/core.
It is a type-safe wrapper around Object.keys – it returns
an array of keys typed as (keyof T)[] instead of string[].
deepMerge
The deepMerge function is exported from @mantine/core.
It recursively merges properties of the source object into the target object.
Arrays are not merged – they are replaced entirely by the source value.
filterProps
The filterProps function is exported from @mantine/core.
It removes all undefined properties from the given object.
isElement
The isElement function is exported from @mantine/core.
It is a type guard that checks whether a value is a React element.
Returns false for arrays, null, and React Fragments.
isNumberLike
The isNumberLike function is exported from @mantine/core.
It checks whether a value is a number or a string that represents
a CSS numeric value (including calc(), var(), and CSS units).
camelToKebabCase
The camelToKebabCase function is exported from @mantine/core.
It converts a camelCase string to kebab-case.
getDefaultZIndex
The getDefaultZIndex function is exported from @mantine/core.
It returns the default z-index value for a given elevation level.
closeOnEscape
The closeOnEscape function is exported from @mantine/core.
It creates a keyboard event handler that calls the given callback
when the Escape key is pressed.
noop
The noop function is exported from @mantine/core.
It is a no-operation function that does nothing. Useful as a
default callback.
findClosestNumber
The findClosestNumber function is exported from @mantine/core.
It finds the number in the given array that is closest to the
provided value. Returns the value itself if the array is empty.
toDateString
The toDateString function is exported from @mantine/dates.
It converts a date value to a YYYY-MM-DD string.
Accepts Date, string, number, and dayjs objects.
Returns null or undefined if the input is null or undefined.
toDateTimeString
The toDateTimeString function is exported from @mantine/dates.
It converts a date value to a YYYY-MM-DD HH:mm:ss string.
Accepts Date, string, number, and dayjs objects.
Returns null or undefined if the input is null or undefined.
assignTime
The assignTime function is exported from @mantine/dates.
It assigns a time string in HH:mm:ss format to a date value,
returning a YYYY-MM-DD HH:mm:ss string. If the date value is null,
the current date is used.
clampDate
The clampDate function is exported from @mantine/dates.
It clamps a date between optional min and max boundaries, returning
a YYYY-MM-DD HH:mm:ss string.