Thanks Martin,

that works for us. I missed that Variants are inherited from parents.

Is there also a good way that I can assure in our unit tests that the
variant markup for certain components exists and was found? Else a
typo would go unnoticed in the unit tests.


On Wed, Sep 3, 2014 at 12:59 PM, Martin Grigorov <> wrote:
> Hi,
> The behaviors are not used for variations.
> For such use cases you should
> override org.apache.wicket.Component#getVariation() on the (base) page.
> This way all components will know the correct variation.
> Martin Grigorov
> Wicket Training and Consulting
> On Wed, Sep 3, 2014 at 1:09 PM, Thibault Kruse <>
> wrote:
>> Hi,
>> playing around with Variants for Components, I am wondering whether
>> there is an elegant way to steer Variant markup loading via a
>> Behavior.
>> In our case we want to use a different markup layout based on the
>> width of the container the component is going to be used in, visually.
>> So if we imagine a Browser window with desktop size, we might want to
>> use a component on the full width, on a third of the width, or a
>> quarter of the width.
>> For each such container width, we need different responsive design
>> markup. Since this may affect many of our components which inherit
>> from different wicket components, I'd like to just add another html
>> markup file for the variant, and add a Behavior to the component that
>> decides the Variant.
>> cheers,
>>   Thibault
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail:
>> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

Reply via email to