18 lines
622 B
JavaScript
18 lines
622 B
JavaScript
// components/Label.js
|
|
import { ui, val } from "../core/utils.js";
|
|
|
|
export const Label = (props) => {
|
|
const { children, value, floating = false, class: className, ...rest } = props;
|
|
|
|
if (floating) {
|
|
return Tag("label", { class: ui("floating-label", className), ...rest }, () => [
|
|
typeof children === 'function' ? children() : children,
|
|
value ? Tag("span", {}, val(value)) : null
|
|
]);
|
|
}
|
|
|
|
return Tag("label", { class: ui("label", className), ...rest }, () => [
|
|
value ? Tag("span", { class: "label-text" }, val(value)) : null,
|
|
typeof children === 'function' ? children() : children
|
|
]);
|
|
}; |