A multilayer surface detector for ultracold neutrons (UCNs) is described. The top $^{10}$B layer is exposed to the vacuum chamber and directly captures UCNs. The ZnS:Ag layer beneath the $^{10}$B layer is a few microns thick, which is sufficient to detect the charged particles from the $^{10}$B(n,$alpha$)$^7$Li neutron-capture reaction, while thin enough so that ample light due to $alpha$ and $^7$Li escapes for detection by photomultiplier tubes. One-hundred-nm thick $^{10}$B layer gives high UCN detection efficiency, as determined by the mean UCN kinetic energy, detector materials and others. Low background, including negligible sensitivity to ambient neutrons, has also been verified through pulse-shape analysis and comparisons with other existing $^3$He and $^{10}$B detectors. This type of detector has been configured in different ways for UCN flux monitoring, development of UCN guides and neutron lifetime research.