Utility functions for React components providing hooks, PropType validators, DOM utilities, and component helpers.
—
Pending
Does it follow best practices?
Impact
Pending
No eval scenarios have been run
Pending
The risk profile of this skill
Text manipulation and formatting utilities for user interface content. These utilities handle common string operations needed in React applications.
Capitalizes the first letter of a string while preserving the rest of the string.
/**
* Capitalizes first letter of string
* @param string - String to capitalize
* @returns String with first letter capitalized
*/
function unstable_capitalize(string: string): string;Usage Example:
import { unstable_capitalize as capitalize } from '@mui/utils';
const capitalized = capitalize('hello world'); // "Hello world"
const alreadyCapitalized = capitalize('Hello World'); // "Hello World"
const empty = capitalize(''); // ""
const singleChar = capitalize('a'); // "A"
// Usage in component
function UserGreeting({ name }) {
return <h1>Hello, {capitalize(name)}!</h1>;
}Formats MUI error messages with error codes for production builds.
/**
* Formats MUI error messages with codes
* @param code - Error code number
* @param args - Additional arguments for error message
* @returns Formatted error message string
*/
function formatMuiErrorMessage(code: number, ...args: any[]): string;Usage Example:
import { formatMuiErrorMessage } from '@mui/utils';
// In development: returns full error message
// In production: returns formatted message with error code
const errorMessage = formatMuiErrorMessage(123, 'ComponentName', 'propName');
// Usage in component validation
function validateProps(props) {
if (!props.required) {
throw new Error(formatMuiErrorMessage(456, 'MyComponent', 'required'));
}
}