Skip to content

Overriding a component

Run stratolms theme eject CourseCard. The CLI copies the current built-in source to src/theme/overrides/CourseCard.astro and adds one export to the override barrel. Edit that file and run pnpm verify:theme plus the normal checks. An existing override is never overwritten unless --force is given.

An override is a normal source file in the site. It is statically imported, typechecked, and selected for every page through the one registry merge point.

Layouts use the same local precedence. Export a layouts object from src/theme/overrides/index.ts, for example:

import CourseShowcase from './CourseShowcase.astro';
export const layouts = {
course: { showcase: CourseShowcase },
};