Suifrens Display System
Render Suifrens capys and bullsharks in React with @sugarcasino/suifrens-display-system. The Sugar library supports avatars, portraits and animated battle scenes, with accessories and runner or football outfits.
GitHub: Sugar TypeScript SDKs repository npm: @sugarcasino/suifrens-display-system
These examples use version 0.1.0-beta.2. If you already use 1.x, follow the migration guide.
What this is for
- Render a capy or bullshark from typed appearance attributes.
- Add catalogue accessories, VIP crowns or custom artwork.
- Show full-body characters or head portraits.
- Play animation presets or custom sequences.
- Build runner outfits, football kits and duel scenes.
- Export SVG markup with embedded built-in accessories.
You can render a character from its attributes without connecting a wallet or an RPC. For Sugar transactions and on-chain reads, use the SDK. The MCP server lets coding agents work with those transactions.
Installation
In a React app:
pnpm add @sugarcasino/suifrens-display-system@0.1.0-beta.2
The package uses ESM imports and requires React and React DOM ^18.2.0 || ^19.0.0 as peer dependencies. Install both in your app.
Render a character
A capy uses earShape; a bullshark uses finStyle. Both share colors, skin and expression fields.
import { SuiFrenImage } from '@sugarcasino/suifrens-display-system';
import type { BullsharkAttributes, CapyAttributes } from '@sugarcasino/suifrens-display-system/attributes';
const capy = {
mainColor: '6fbbee',
secondaryColor: 'e6fbff',
skin: 'basic',
expression: 'happy',
earShape: 'default',
} satisfies CapyAttributes;
const bullshark = {
mainColor: '6fbbee',
secondaryColor: 'e6fbff',
skin: 'basic',
expression: 'happy',
finStyle: 'classic',
} satisfies BullsharkAttributes;
export function Characters() {
return (
<>
<SuiFrenImage attributes={capy} renderSize={240} shadow />
<SuiFrenImage attributes={bullshark} renderSize={240} shadow />
</>
);
}
Colors are lowercase palette keys without a leading #. The available palette is COLORS from /colors. Import SuiFrenAppearance from /attributes when sharing the common appearance fields between species.
Use detail="head" for a portrait. The gesture prop accepts thumbs_up, thumbs_down or point for full-body characters. Held objects take precedence over gestures; portraits are unaffected.
Accessories and outfits
Pass catalogue entries from ACCESSORIES or VIP_CROWN_ACCESSORIES to the accessories prop. Both catalogues are exported from /accessories. Custom accessories use the SuiFrenAccessory type from /accessories.
For a complete runner outfit, use buildRunnerAccessories:
import { SuiFrenImage } from '@sugarcasino/suifrens-display-system';
import { buildRunnerAccessories } from '@sugarcasino/suifrens-display-system/kits';
const runnerAccessories = buildRunnerAccessories({ color: '#ef8fae', number: 7 });
// Use the capy attributes from the previous example.
<SuiFrenImage attributes={capy} accessories={runnerAccessories} renderSize={240} />;
Runner outfit colors use CSS hexadecimal values with #, unlike the character palette keys. Football kits use renderOptions.kit with type: 'soccer'; /kits exports SOCCER_TEAM_KITS, resolveSoccerCountryCode and resolveSoccerTeamKit. See the package types for country, team, side and custom color options.
Animation
Pass animation settings through the single animation prop. Choose either a built-in preset or a custom sequence.
import { SuiFrenImage } from '@sugarcasino/suifrens-display-system';
import type { AnimationPresetName } from '@sugarcasino/suifrens-display-system/animation';
const walkingPreset = 'walk' satisfies AnimationPresetName;
<SuiFrenImage attributes={capy} renderSize={240} animation={{ preset: walkingPreset, playback: { iterations: 'infinite' } }} />;
Omit animation or pass null for a static character. Animations play once at their original speed by default. Set playState to control playback and change trigger to restart it. Import AnimationConfig and AnimationSequence from /animation for typed configuration.
Use getPresetSequence and getPresetDurationMs from /animation to look up presets and their durations. The /battle entry exports SuiFrenBattleSprite, MinecraftHealthBar and useDuelScript. In a duel attack step, put the attacker's side, animation and expression under attacker. The opponent's damage, reaction and impact delay belong under target.
External and inline SVG rendering
SuiFrenImage uses external SVG accessory URLs that browsers can cache. Your bundler or deployment must serve the emitted SVG assets alongside the JavaScript modules.
For standalone SVG exports, import the inline renderer:
import { SuiFrenImage } from '@sugarcasino/suifrens-display-system/embed';
<SuiFrenImage attributes={capy} accessories={runnerAccessories} renderSize={240} />;
The inline renderer embeds built-in accessory artwork, including VIP crowns, and accepts the same props. Use renderOptions.assetSrc to supply custom artwork. VIP crowns keep their catalogue framing when the image changes. Set renderOptions.viewport to override that framing in either renderer. Use an SVG data URL when that custom image must remain self-contained in an exported SVG.
Public package exports
Use the root SuiFrenImage for both species. Import image props from the root and other types from their feature entry.
| Entry point | Purpose |
|---|---|
@sugarcasino/suifrens-display-system | External SVG image renderer and image props |
@sugarcasino/suifrens-display-system/embed | SuiFrenImage for embedded SVG accessories |
@sugarcasino/suifrens-display-system/accessories | Accessory catalogue, slot lookup and VIP crowns |
@sugarcasino/suifrens-display-system/animation | Animation types and preset helpers |
@sugarcasino/suifrens-display-system/battle | Battle sprite, health bar and duel script hook |
@sugarcasino/suifrens-display-system/kits | Runner and football outfit helpers |
@sugarcasino/suifrens-display-system/colors | COLORS palette |
@sugarcasino/suifrens-display-system/attributes | Ear gene mappings and skin values |
@sugarcasino/suifrens-display-system/expressions | Shared expression lists |
Data constants and catalogues use uppercase names such as COLORS, ACCESSORIES, VIP_CROWN_ACCESSORIES and EAR_GENE_TO_EAR_SHAPE. Functions and hooks use camelCase; components and types use PascalCase.
Source and further guidance
The character renderers and accessory artwork come from Mysten Labs' SuiFrens Display System. Sugar added gestures, animation playback, VIP crowns and outfits. Both projects use Apache License 2.0.
- Package README
- Migration from 1.x
- Changelog
- Sugar agent skills for rendering, animation and duel integration