d3-view
Version:
View-model d3 plugin for building interactive data-driven web interfaces
14 lines (12 loc) • 380 B
JavaScript
export default function(field, wrappedEl, fieldEl) {
var data = field.props;
if (data.help) {
fieldEl.attr("aria-describedby", `help-${data.id}`);
return field.wrapTemplate(wrappedEl, helpTpl(data));
} else return wrappedEl;
}
function helpTpl(data) {
return `<slot></slot><small id="help-${
data.id
}" class="form-text text-muted">${data.help}</small>`;
}