Basic Usage
Import and use icon components like any React component:Icon Props
All icon components accept the following props:Color
Set the icon color using thecolor prop:
currentColor, which inherits the current text color from CSS.
Size
Control icon dimensions using thesize prop (in pixels):
16px when neither size nor autoSize is specified.
Auto Size
Make icons scale with font size usingautoSize:
autoSize={true}, the icon dimensions are set to 1em, making it scale with the parent’s font size.
SVG Props
Pass additional props to the underlying SVG element:HTML Span Props
The icon wrapper is a<span> element that accepts standard HTML props (except color and size):
Icon Structure
Each icon component is wrapped in anIconWrapper that:
- Wraps the SVG in a
<span>element - Sets default dimensions to
16pxor1em(ifautoSizeis true) - Applies
display: inline-flexfor proper alignment - Inherits font size for responsive scaling
Available Icons
The package includes icons for all Drift UI elements:Trading Icons
Trade,TradingUp,Swap,TransferPositions,OrderBook,RecentTradesStake,Withdraw,Deposit
Status Icons
Success,SuccessFilledWarning,WarningFilledError,ErrorFilled
UI Icons
Settings,SettingsTrade,SettingsOtherSearch,Menu,Notification,NotificationNewRefresh,Upload,Share
Social Icons
Twitter,Telegram,Discord,Medium
Market Icons
Spot,NewMarket,PreLaunchStats,PieChart,Overview
@drift-labs/icons.
Best Practices
Use currentColor
LeveragecurrentColor to make icons inherit text color: