charmbracelet / huh

Build terminal forms and prompts 🤷🏻‍♀️
MIT License
3.72k stars 94 forks source link

Hiding implicit focus indicators #296

Open meowgorithm opened 1 week ago

meowgorithm commented 1 week ago

Having seen Huh in action for a bit, I think a good improvement would be to eliminate the focus indicators when they're implicit, with the goal of making the experience more visually focused and concise.

In other words, I don't think we always need to draw the little bar that indicates the active section in all cases.

Off the top of my head, the logic would work like this:

  1. If the entire form is one single field, hide the indicator.
  2. If the entire form has multiple groups with one single field in each group, hide all indicators.
  3. In all other cases show the indicator.
dez11de commented 3 days ago

Creators of such forms that don't want the little bar can simply set theme.Focused.Base.BorderStyle to HiddenBorder.

meowgorithm commented 3 days ago

From a design perspective I'd prefer to default to hiding implicit indicators to reduce visual noise.

There's also a catch: focus indicators may not necessarily be borders: a theme could instead employ something different, such as a background color on the group, so manually adjusting borders won't necessarily do the trick.

If we find the former behavior is desired we could also add an option to enable it.