Skip to content
feega
star on github download

Edit a shared component everywhere or one instance only

See where an edit to a shared component lands, how many instances and files it reaches, and change a single instance with Detach.

When you select an element that comes from a shared component, Feega tells you where the edit will land before you make it. You can see how many instances and files it reaches, and use Detach to change one usage only.

One line under the breadcrumb is the impact label. It updates when you select an element and when the scope, state, breakpoint or theme changes.

  • This element only means the edit stays in this element. In a list, it reads This file only · ×N on this page.
  • Button component · used in 4 files · ×3 here means the edit lands in the source of the component, so every file that imports it is affected. The first number is the files that use the component. The second is the instances on the current page, and it shows when there is more than one.
  • Impact unknown means Feega cannot tell where the edit lands. Hover the label for the reason.

Click the label to list the files that use the component. Click a file to open it at the usage. Tests and stories do not count.

The scope toggle sits below the impact label. It has two buttons:

  • This element edits the selected element. When the element has several instances, it reads This element ×3, with the instance count.
  • All .card (14) edits the rule of the first class of the element, for every element that has that class, with the count of those elements. It is disabled when the element has no class with a CSS rule, and in Tailwind projects. See Classes.

To change a single usage of a shared component, click Only this one next to the impact label. The right-click menu of the selected element has the same action as Detach instance.

Detach does this:

  1. Copies the component file next to the original. The copy is named after the page or route that uses it, so Button.tsx becomes ButtonPricing.tsx.
  2. Renames the component inside the copy.
  3. Points only that usage, its import and its tag, at the copy.

Edits to the copy no longer reach the other instances. Detach is one undo step. Undo removes the copy and restores the usage.

Detach works on React (.tsx, .jsx), Svelte, Vue and Astro components. On other files the action is disabled and says why. Feega also refuses, with the reason, when the usage is rendered in a loop or is a dynamic component.

  • Components lists every component and how many files use each one.
  • Classes edits a CSS rule once for every element that uses it.
  • Undo and changes shows and reverts what you changed.