clsx 0.1.1 copy "clsx: ^0.1.1" to clipboard
clsx: ^0.1.1 copied to clipboard

An unofficial Dart port of the popular JavaScript utility 'clsx' for constructing className strings conditionally.

example/clsx_example.dart

// This file contains an example of how to use the clsx function in Dart.
// ignore_for_file: avoid_print, prefer_final_locals, omit_local_variable_types

import 'package:clsx/clsx.dart';

void main() {
  String activeClass = 'active';
  bool isDisabled = false;

  final buttonClasses = clsx([
    'btn',
    activeClass,
    {'btn-disabled': isDisabled},
    ['extra-class', null],
    {'another-class': true},
  ]);

  print(buttonClasses);
}
0
likes
155
points
36
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

An unofficial Dart port of the popular JavaScript utility 'clsx' for constructing className strings conditionally.

Repository (GitHub)
View/report issues

Topics

#web #css #classes #clsx #utility

License

MIT (license)

More

Packages that depend on clsx