OptionalWrapper
OptionalWrapper is a utility for elegant conditional wrapping. Internally it uses Show to decide whether to apply a wrapper, avoiding nested ternaries or duplicated wrapper code. For example, you can render content wrapped in an a tag when a link is required, or render the content as-is when no wrapper is needed.
Basic usage#
In the simplest case you provide a boolean condition and a wrapper (or 'as' prop); the content will be wrapped only when the condition is true. This pattern is useful for conditionally applying links, tooltips, or other wrappers without duplicating markup.