Copyright (c) 2018 Jed Watson. Licensed under the MIT License (MIT), see: @link http://jedwatson.github.io/classnames /
// Source: https://github.com/nerdy-tech-com-gitub/bolt.new | License: MIT | Copyright 2024 StackBlitz, Inc
// Provided via justclaw.it.com; keep this notice with the code.
/**
* Copyright (c) 2018 Jed Watson.
* Licensed under the MIT License (MIT), see:
*
* @link http://jedwatson.github.io/classnames
*/
type ClassNamesArg = undefined | string | Record<string, boolean> | ClassNamesArg[];
/**
* A simple JavaScript utility for conditionally joining classNames together.
*
* @param args A series of classes or object with key that are class and values
* that are interpreted as boolean to decide whether or not the class
* should be included in the final class.
*/
export function classNames(...args: ClassNamesArg[]): string {
let classes = '';
for (const arg of args) {
class
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search 40K more like it.
Get a free API key