> For AI agents: the complete documentation index is available at https://wallarm.github.io/design-system/llms.txt, the full documentation bundle is available at https://wallarm.github.io/design-system/llms-full.txt.

# AgentLookBuilder

The kit for letting an admin pick a custom agent’s look: shapes, colors, eyes and props with display names, `defaultLook` for a first look and `lookIssues` for the combinations to avoid. It ships no picker UI; the stories build one from `Select`. An app that shows stored custom looks calls `enableAgentLookLibrary()` once at start-up; without it only the presets’ props are drawn.

[Source](https://github.com/wallarm/design-system/tree/main/packages/design-system/src/components/AgentLookBuilder) · [Storybook](https://wallarm.github.io/design-system/storybook/?path=/docs/ai-characters-agentlookbuilder--overview)

```tsx
import { useState } from 'react';
import { AgentAvatar } from '@wallarm-org/design-system/AgentAvatar';
import { AgentGlyph } from '@wallarm-org/design-system/AgentGlyph';
import { type AgentLook, defaultLook, enableAgentLookLibrary, lookIssues } from '@wallarm-org/design-system/AgentLookBuilder';
import { Button } from '@wallarm-org/design-system/Button';
import { Select, SelectButton, SelectContent, SelectOption, SelectOptionIndicator, SelectOptionText, SelectPositioner } from '@wallarm-org/design-system/Select';
import { HStack, VStack } from '@wallarm-org/design-system/Stack';
import { Text } from '@wallarm-org/design-system/Text';

export const AnyLook = () => {
  // In an app: once at start-up, before any stored custom look renders (here, before this story's first render).
  enableAgentLookLibrary();
  const [look, setLook] = useState<AgentLook>(FIRST_LOOK);
  const [draws, setDraws] = useState(0);
  const issues = lookIssues(look, { isWally: false, others: [] });

  const handleShape = ({ value }: { value: string[] }) =>
    setLook({ ...look, shape: value[0] as AgentLook['shape'] });
  const handleColor = ({ value }: { value: string[] }) =>
    setLook({ ...look, color: value[0] as AgentLook['color'] });
  const handleEyes = ({ value }: { value: string[] }) =>
    setLook({ ...look, eyes: value[0] as AgentLook['eyes'] });
  const handleProp = ({ value }: { value: string[] }) =>
    setLook({ ...look, prop: value[0] as AgentLook['prop'] });
  const handleRandom = () => {
    setLook(defaultLook(`random-${draws}`, [], PROP_POOL));
    setDraws(draws + 1);
  };

  return (
    <VStack gap={24} align='start' data-testid='any-look'>
      <HStack gap={24} align='end'>
        <AgentAvatar look={look} size={72} seed='builder' live data-testid='any-look--avatar' />
        <AgentGlyph look={look} size={24} data-testid='any-look--glyph-24' />
        <AgentGlyph look={look} size={20} data-testid='any-look--glyph-20' />
      </HStack>
      <HStack gap={12} align='start'>
        <Select
          collection={shapes}
          value={[look.shape]}
          onValueChange={handleShape}
          data-testid='any-look--shape'
        >
          <SelectButton aria-label='Shape' />
          <SelectPositioner>
            <SelectContent>
              {shapes.items.map(item => (
                <SelectOption key={item.value} item={item}>
                  <SelectOptionText>{item.label}</SelectOptionText>
                  <SelectOptionIndicator />
                </SelectOption>
              ))}
            </SelectContent>
          </SelectPositioner>
        </Select>
        <Select
          collection={colors}
          value={[look.color]}
          onValueChange={handleColor}
          data-testid='any-look--color'
        >
          <SelectButton aria-label='Colour' />
          <SelectPositioner>
            <SelectContent>
              {colors.items.map(item => (
                <SelectOption key={item.value} item={item}>
                  <SelectOptionText>{item.label}</SelectOptionText>
                  <SelectOptionIndicator />
                </SelectOption>
              ))}
            </SelectContent>
          </SelectPositioner>
        </Select>
        <Select
          collection={eyes}
          value={[look.eyes]}
          onValueChange={handleEyes}
          data-testid='any-look--eyes'
        >
          <SelectButton aria-label='Eyes' />
          <SelectPositioner>
            <SelectContent>
              {eyes.items.map(item => (
                <SelectOption key={item.value} item={item}>
                  <SelectOptionText>{item.label}</SelectOptionText>
                  <SelectOptionIndicator />
                </SelectOption>
              ))}
            </SelectContent>
          </SelectPositioner>
        </Select>
        <Select
          collection={props}
          value={[look.prop]}
          onValueChange={handleProp}
          data-testid='any-look--prop'
        >
          <SelectButton aria-label='Prop' />
          <SelectPositioner>
            <SelectContent>
              {props.items.map(item => (
                <SelectOption key={item.value} item={item}>
                  <SelectOptionText>{item.label}</SelectOptionText>
                  <SelectOptionIndicator />
                </SelectOption>
              ))}
            </SelectContent>
          </SelectPositioner>
        </Select>
        <Button
          variant='outline'
          color='neutral'
          onClick={handleRandom}
          data-testid='any-look--random'
        >
          Random
        </Button>
      </HStack>
      <VStack gap={4} align='start' data-testid='any-look--issues'>
        {issues.map(issue => (
          <Text key={issue.code} size='sm' color='danger'>
            {ISSUE_TEXT[issue.code]}
          </Text>
        ))}
      </VStack>
    </VStack>
  );
};
```

## Usage

```tsx
import { AgentAvatar } from '@wallarm-org/design-system/AgentAvatar';
import { AgentGlyph } from '@wallarm-org/design-system/AgentGlyph';
import { type AgentLook, defaultLook, enableAgentLookLibrary, lookIssues } from '@wallarm-org/design-system/AgentLookBuilder';
import { Button } from '@wallarm-org/design-system/Button';
import { Select, SelectButton, SelectContent, SelectOption, SelectOptionIndicator, SelectOptionText, SelectPositioner } from '@wallarm-org/design-system/Select';
import { HStack, VStack } from '@wallarm-org/design-system/Stack';
import { Text } from '@wallarm-org/design-system/Text';
```

## Examples

### Library

Every shape in the first color of each palette group (coral, Wally's, aside), static, with no prop; the last
column wears the magnifier, a library prop that shows only on the 3D character.

```tsx
import { AgentAvatar } from '@wallarm-org/design-system/AgentAvatar';
import { AGENT_COLORS, AGENT_SHAPES, enableAgentLookLibrary } from '@wallarm-org/design-system/AgentLookBuilder';
import { HStack, VStack } from '@wallarm-org/design-system/Stack';
import { Text } from '@wallarm-org/design-system/Text';

export const Library = () => {
  // In an app: once at start-up, before any stored custom look renders.
  enableAgentLookLibrary();
  const groups = [...new Set(AGENT_COLORS.filter(c => !c.brand).map(c => c.group))];
  const firstColors = groups.map(g => AGENT_COLORS.find(c => c.group === g)?.id ?? 'cobalt');

  return (
    <VStack gap={12} align='start' data-testid='library'>
      {AGENT_SHAPES.map(s => (
        <HStack key={s.id} gap={12} align='center'>
          <div className='w-80'>
            <Text size='sm'>{s.name}</Text>
          </div>
          {firstColors.map(color => (
            <AgentAvatar
              key={color}
              look={{ v: 1, shape: s.id, color, eyes: 'oval', prop: 'none' }}
              size={48}
              seed={`${s.id}-${color}`}
              data-testid={`library--${s.id}-${color}`}
            />
          ))}
          <AgentAvatar
            look={{ v: 1, shape: s.id, color: 'sky', eyes: 'oval', prop: 'magnifier' }}
            size={48}
            seed={`${s.id}-magnifier`}
            data-testid={`library--${s.id}-magnifier`}
          />
        </HStack>
      ))}
    </VStack>
  );
};
```
