In the previous chapter, Runtime Availability Logic, we implemented a "circuit breaker" to stop our tool from running its logic using the isEnabled function.
Now that we know how to turn the tool's engine off, we need to answer a different question: Should the audience see the tool on the stage?
Imagine you are watching a theater play. There are actors on stage, but there are also stagehands moving props in the background.
The stagehands are crucial, but you don't want them blocking the view of the main actors. If every single background tool appeared on the main menu, your application would look messy, confusing, and overwhelming.
We need a way to tell the system: "I am here, and I am part of the crew, but please don't shine a spotlight on me."
We solve this using Visibility Management. In our code, this is controlled by the isHidden property.
Think of isHidden as the Stagehand's Black Clothing.
isHidden: false: The actor is wearing a costume. They stand center stage. The user sees them in the menu.isHidden: true: The stagehand wears all black. They are present in the room, but they blend into the shadows so the audience doesn't notice them.We are building a "Stub" tool. Since this tool is just a placeholder and doesn't do anything useful yet, we don't want users clicking on it. It would just confuse them.
Therefore, we will hand our tool the "black clothing" to wear.
isHidden PropertyWe add a simple boolean (true/false) value to our configuration object.
// index.js
export default {
name: 'stub',
isEnabled: () => false,
// The Invisible Cloak
isHidden: true
};
Explanation:
isHidden: This is the property name the system looks for.true: By setting this to true, we are explicitly asking the User Interface (UI) to hide us.
Goal: The system is drawing the navigation menu for the user.
Input: The system reads our index.js file.
Action: The system checks the value of isHidden.
Output: Because it is true, the system skips drawing a button for "stub". The tool is loaded in memory, but invisible on screen.
It is easy to confuse Runtime Availability Logic (isEnabled) with Visibility Management (isHidden). Here is the difference:
| Property | Concept | Analogy |
|---|---|---|
isEnabled |
Logic. Can the code run? | Is the car engine on? |
isHidden |
Visual. Can the user see it? | Is the car parked in the garage (hidden) or the driveway (visible)? |
For our Stub, we want it both Disabled (safe) and Hidden (clean).
How does the system decide what to draw? Let's visualize the "Menu Builder" process.
Let's look at the final piece of our index.js.
--- File: index.js ---
export default {
isEnabled: () => false,
// Visibility Management
isHidden: true,
name: 'stub'
};
Why do we need to export this? You might ask: "If the tool is hidden and disabled, why load it at all?"
isHidden: false for "Admin" users, but keep it true for "Regular" users.In this chapter, we learned:
isHidden: true.We have now fully defined our tool's ID Badge: it has a Name (Component Identity), a Status (Runtime Availability Logic), and a Visibility setting.
We have a perfect description of a tool, but we haven't actually organized the files to make this a reusable pattern yet. In the final chapter, we will put it all together.
Next Chapter: Stub Implementation Pattern
Generated by Code IQ