tags 0.0.7
tags: ^0.0.7 copied to clipboard
Build html elements by tag name.
Tags #
Build html elements by tag name in Dart.
Build Html Fluently #
Tags makes it easy to build trees of html elements in code. Consider an example:
import 'package:tags/html.dart';
main() {
document.body.append(
ul(() {
li()..text = 'Coffee';
li()..text = 'Tea';
li()..text = 'Milk';
}));
}
Define Custom Tags #
Tags allows you to extend html and define your own custom elements! Consider an example:
import 'package:tags/builder.dart';
import 'package:tags/html.dart';
final Tag toggleButton =
([Build b]) => build(() => new ToggleButton().element, b);
main() {
document.body.append(
div(() {
toggleButton(() {
span()..text = 'up'..classes = ['up'];
span()..text = 'down'..classes = ['down'];
});
}));
}
By defining a custom tag such as toggleButton you may build trees of elements
that contain not only the standard html elements but also your custom elements.
Tags uses the MIT license as described in the LICENSE file, and follows semantic versioning.
