Category Master — Root Category Form (Level 0)

By Engineering Team•October 9, 2026•2 min read

Root category add/edit drawer form, showing the Spec Template chip field

What the admin sees

CategoryRootLeafPage.tsx, rendered inside the drawer when a Level 0 node is being added or edited. The form has:

  • Category Name — free text.
  • Slug — free text, with a helper note (“Auto-generated from name in add mode”) reflecting that useCategoryRootLeafController’s setName auto-derives the slug from the name while in add mode; the admin can still edit it manually before submitting.
  • Spec Template — a chip-based multi-value field. The admin types a value and presses Enter to add it as a chip; each chip can be removed individually. Any text still sitting in the input when the form is submitted is auto-flushed into the list rather than discarded.

An error Alert appears above the Cancel/Submit row if validation fails. The submit button reads “Create Root” in add mode or “Save Changes” in edit mode.

What the admin does here

Submitting validates, in order: Name is required, Slug is required, and at least one Spec Template entry is required. On success it calls onAdd/onUpdate with nodeLevel: 0, parentId: null, displayOrder: 0, mainDisplayCategory: false, and variantAttributes: [] — these last three are always fixed for a root category and are never admin-editable fields on this form.

In edit mode, the form is pre-filled from the full record already fetched by CategoryController.ts’s openEditDrawer (GET /product/admin/api/v1/category/:id) — name, slug, and specTemplate all populate correctly, including the chip list.