CharacterSelector
形状与墨色选择器。
形状
配色
选中环跟随形状
高亮环沿所选形状自己的轮廓绘制,而不是通用的圆,所以六边形的环也是六边形。这个环是 CSS 蒙版,由绘制身体的同一个函数生成,因此用 defineShape 注册的形状无需额外处理,也能得到正确的环。
布局
形状
配色
脸型与鼻子
传入 face 会增加一个 cute | eyes | line 切换。选中线条脸时,下方会多出一行六种鼻子。每个形状的预览都按所选脸型绘制,所见即所得。
形状
配色
脸型
鼻子
省略 face 时,选择器仍然只有形状和墨色两组选项。
限制选项
形状
配色
预览尺寸
sizePx 设置每个形状预览的大小,脸型和鼻子的预览随之缩放。默认值是 SELECTOR_MARK_PX(36)。lineWeight 会传给各个预览,使选择器的线宽与正在编辑的角色一致。
形状
配色
颜色色块
每个色块显示身体在当前页面上的实际颜色(getInkColorCss),所以 black 的色块在深色模式下是白色。与页面背景几乎同色的色块,会带上与身体相同的细边(--aora-rim)。参见配色。
onSelectColor
墨色的回调叫 onSelectColor,与 color prop 及回调返回的 ColorId 类型使用同一个拼写。
另外两个选择器
AgentCharacterSelector 会暂存修改,确认后才生效,适合点击只是提议、取消必须真正放弃修改的对话框。CompactCharacterSelector 只提供少量形状和墨色,适合放在注册表单旁边。
键盘与辅助技术
每一行是一个单选组(形状、墨色,启用时还有脸型和鼻子),都有可访问名称。每个选项都带 role="radio" 和 aria-checked,焦点可见。Tab 在组之间切换,方向键在组内移动,与常规单选组的行为一致。
API
| 属性 | 类型 | 默认值 | 说明 |
|---|---|---|---|
color* | "cream" | "ivory" | "black" | "brown" | "red" | "orange" | "yellow" | "green" | "cyan" | "blue" | "violet" | "magenta" | "pink" | "gray" | "sage" | "clay" | "navy" | "mauve" | "night" | "cocoa" | "sky" | "blush" | "lilac" | "butter" | "meadow" | "peach" | "pine" | "crimson" | "snow" | "indigo" | "crust" | "jade" | "peel" | "mint" | "carrot" | "caramel" | "lagoon" | "lemon" | "aqua" | "sand" | "grass" | "wine" | "plum" | — | — |
shape* | "circle" | "mochi" | "blob" | "pebble" | "egg" | "bun" | "tofu" | "pill" | "hex" | "onigiri" | "gem" | "cloud" | "drop" | "leaf" | "flower" | "clover" | "sprout" | "mushroom" | "acorn" | "cactus" | "eggplant" | "pear" | "apple" | "strawberry" | "cherry" | "avocado" | "melon" | "pudding" | "toast" | "icecream" | "cupcake" | "fries" | "candy" | "burger" | "star" | "heart" | "flame" | "bell" | "ghost" | "bot" | "crescent" | "boba" | "planet" | "cottage" | "chat" | "gift" | "bulb" | "fish" | "octopus" | "seal" | "puffer" | "cat" | "bunny" | "bear" | "chick" | "penguin" | "pig" | "fox" | "lion" | "hamster" | "hedgehog" | "koala" | "bat" | "bob" | "topknot" | "spiky" | "curly" | "twinbuns" | "chunk" | "lump" | "fluff" | "spook" | "pumpkin" | "nightcat" | "batling" | "cauldron" | "witch" | "toffee" | "manor" | "wisp" | "deadtree" | "scarecrow" | "tombstone" | "candycorn" | "mummy" | "skull" | "spider" | "owl" | "pail" | "candle" | "vampire" | "witchmochi" | "lanterncat" | "nightcapmoon" | "xm-tree" | "xm-snowman" | "xm-ginger" | "xm-deer" | "xm-stocking" | "xm-cane" | "xm-globe" | "xm-santa" | "xm-cocoa" | "xm-bauble" | "xm-mochi-hat" | "xm-chirp-hat" | "xm-waddle-scarf" | "xm-miso-antlers" | "xm-kiki-muffs" | "xm-pokey-mittens" | "xm-pud-holly" | "xm-chime-holly" | "sf-tangyuan" | "sf-hongbao" | "sf-firecracker" | "sf-fu" | "sf-nian" | "sf-knot" | "sf-orange" | "sf-goat" | "sf-koi" | "sf-ingot" | "sf-kiki-tiger" | "sf-waddle-scarf" | "sf-hop-lantern" | "sf-maru-collar" | "sf-mochi-fu" | "sf-lulu-crackers" | "sf-nook-couplets" | "sf-chirp-lion" | "ma-mooncake" | "ma-rabbit" | "ma-lantern" | "ma-osmanthus" | "ma-moon" | "ma-pomelo" | "ma-skylantern" | "ma-crab" | "ma-mochi-ears" | "ma-hop-cake" | "ma-chirp-cake" | "ma-lulu-pin" | "ma-kiki-pin" | "ma-miso-lamp" | "ma-waddle-lamp" | "ma-bao-hat" | "ma-pip-hat" | "ea-dapple" | "ea-wicker" | "ea-cocoa" | "ea-crunchy" | "ea-posy" | "ea-breezy" | "ea-peeky" | "ea-hop-crown" | "ea-chirp-shell" | "ea-mochi-ears" | "ea-momo-ears" | "ea-waddle-shell" | "ea-kiki-crown" | "ea-lulu-bow" | "ea-hammy-basket" | "sm-popsicle" | "sm-coconut" | "sm-ring" | "sm-castle" | "sm-fan" | "sm-ice" | "sm-pineapple" | "sm-shell" | "sm-cicada" | "sm-miso-shades" | "sm-waddle-goggles" | "sm-chirp-hat" | "sm-hop-hat" | "sm-bruno-melon" | "sm-koko-lei" | "sm-leo-sunscreen" | "sm-scoop-shades" | "vl-bonbon" | "vl-rose" | "vl-cherub" | "vl-ring" | "vl-dove" | "vl-dipped" | "vl-mochi-stickers" | "vl-miso-bowtie" | "vl-waddle-bowtie" | "vl-bruno-rose" | "vl-hop-glasses" | "vl-oink-stickers" | "vl-kiki-letter" | "vl-chirp-headband" | — | — |
className | string | — | — |
colors | readonly ColorId[] | — | Restrict the offered colours. |
face | "symbol" | "capsule" | "cute" | "eyes" | "line" | "brow" | "glossy" | "sparkle" | "button" | "shades" | "droopy" | "bigmouth" | "pie" | "screen" | "teardrop" | "specs" | — | Face style. Passing this shows the face toggle; in line mode a row of noses follows. Omit it to keep the picker to shape and colour. |
layout | "grid" | "row" | 'grid' | `grid` stacks shapes over colours in fixed columns; `row` keeps both groups on one line. |
lineWeight | number | — | Line weight for the previews, so a picker matches the character it edits. |
nose | "slant" | "angular" | "hook" | "long" | "curve" | "bow" | null | — | Nose for the line face. Defaults to the first nose while `face` is `line`. `null` — the same "no nose" every other surface takes — also lands on the first nose, because the picker has to highlight one of the offered options and "none" is not one of them. |
onSelectColor | ((color: ColorId) => void) | — | — |
onSelectFace | ((face: "symbol" | "capsule" | "cute" | "eyes" | "line" | "brow" | "glossy" | "sparkle" | "button" | "shades" | "droopy" | "bigmouth" | "pie" | "screen" | "teardrop" | "specs") => void) | — | — |
onSelectNose | ((nose: "slant" | "angular" | "hook" | "long" | "curve" | "bow") => void) | — | — |
onSelectShape | ((shape: ShapeId) => void) | — | — |
shapes | readonly ShapeId[] | SHAPE_IDS | Restrict the offered shapes. |
showSelection | boolean | true | Hide the selection ring, for read-only displays. The selection is still announced. |
sizePx | number | — | Size of each shape preview. Face and nose previews scale with it. Defaults to `SELECTOR_MARK_PX`. |
style | CSSProperties | — | — |
接下来
- AgentCharacterSelector——暂存修改,确认后才生效
- AvatarStudio——角色、生成、上传三个标签页
- 角色设置——为智能体选择外观