add capitalizeFirstLetter utility

This commit is contained in:
Elijah Duffy
2025-07-22 11:17:16 -07:00
parent 1cb8445806
commit 026810b32d
2 changed files with 8 additions and 1 deletions

View File

@@ -31,7 +31,8 @@ export {
type IconDef, type IconDef,
getLabel, getLabel,
getValue, getValue,
defaultIconProps defaultIconProps,
capitalizeFirstLetter
} from './util'; } from './util';
export { export {
type ToolbarToggleState, type ToolbarToggleState,

View File

@@ -87,3 +87,9 @@ export function targetMust<T extends HTMLElement>(event: Event): T {
} }
return target; return target;
} }
/** capitalizeFirstLetter capitalizes the first letter of a string */
export const capitalizeFirstLetter = (str: string): string => {
const lower = str.toLowerCase();
return lower.charAt(0).toUpperCase() + lower.slice(1);
};