JSFiddle - React, Tailwind, and code Playground

HTML

<input type="text" data-bind="textInput: name"> <span class="error" data-bind="visible: isInvalid">Required!</span>

CSS

.error {color: red;}

JavaScript

ko.applyBindings(new ViewModel());

function ViewModel(){
	var vm = this;
  vm.name = ko.observable("");
  vm.isInvalid = ko.computed(function() {
  	return vm.name().length == 0;
  });
}