Skip to the content

Bushu部首

Choose the parts you can see in a kanji, intersect their matches, and add a radical picker to your page.

Bushu is the Japanese word 部首 for a kanji radical. About the name

Contents

Getting started

Getting started

Look up a kanji from native parts, then choose a browser picker.

Search without a browser

Install @johnmorrisdotca/bushu. The main entry contains pure lookup and shape functions; /radkfile supplies the native radical index. Each result must contain every chosen part.

import { kanjiForRadicals, radicalForm } from "@johnmorrisdotca/bushu";
import { RADKFILE } from "@johnmorrisdotca/bushu/radkfile";
console.log(radicalForm("汁"),kanjiForRadicals(RADKFILE.radicals,["汁","田"]).slice(0,8));
氵 [
  '演', '浬', '漁',
  '滝', '薄', '藩',
  '簿', '油'
]

Keep RADKFILE keys for lookup, even where a key’s displayed shape differs. Names and kanji strokes are separate entries, so the pure search need not load either. Selection and shapes/names explain the input contracts.

Mount the native picker

import { loadBushuData, mountBushu } from "@johnmorrisdotca/bushu/picker";
const host=document.createElement("div");
document.body.append(host);
const picker=mountBushu(host,{...await loadBushuData(),language:"ja"});
picker.toggle("氵");
console.log(picker.chosen(),picker.matches().length);
picker.destroy();

The picker accepts native keys or supported display shapes. Call destroy() when removing the host. The embed guide supplies the custom-element and frame alternatives.

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/bushu 1.1.0.