@evicons/react

中文文档
0.8.0发布于 2026/11/04MITTypeScriptES Module零依赖构建来源已验证近 30 天下载 3585

EVicons React icon components for e-mobility and EV charging

原始使用文档
文档目录20 节
  1. Installation
  2. Usage
  3. Props
  4. Colour
  5. absoluteStrokeWidth
  6. Small sizes
  7. Accessibility
  8. Icons complement text
  9. Status overlay pattern
  10. Icons
  11. Connectors
  12. Stations and sites
  13. Power and energy
  14. Vehicles
  15. Payment
  16. Status
  17. Markers
  18. Map markers
  19. Compatibility
  20. License

EVicons

@evicons/react

Website: evicons.dev

React components for EVicons, MIT-licensed outline icons for e-mobility and EV charging: charging stations, connector faces, AC/DC and power, energy, vehicles, payment, charge point status and map markers.

EVicons covers only e-mobility; keep using a general icon set such as Lucide for general UI icons. Icons use currentColor and contain no colours. Raw SVG files, a sprite and metadata are in @evicons/svg.

Installation

npm install @evicons/react

Usage

import { PlugType2 } from '@evicons/react'

export function Connector() {
  return (
    <span>
      <PlugType2 size={20} title="Type 2" /> Type 2 · 22 kW
    </span>
  )
}

Every icon is its own module and the package has sideEffects: false, so bundlers only include the icons you import. A single icon can also be imported directly, as a named or default export:

import PlugType2 from '@evicons/react/icons/plug-type-2'

Props

PropTypeDefaultDescription
sizenumber | string24Width and height of the <svg>. Numbers are pixels; strings are passed as is (for example "1em").
strokeWidthnumber | string1.5Stroke width in icon units (the icon is drawn on a 24 × 24 grid).
absoluteStrokeWidthbooleanfalseKeep the stroke at strokeWidth screen pixels at every size (see below).
classNamestringAdded after the built-in classes evicon and evicon-<name> (for example evicon-plug-type-2).
titlestringAccessible name, rendered as <title> (see Accessibility).
refForwarded to the <svg> element.
...all other SVG propsPassed through to the <svg> element (style, onClick, data-*, aria-*, role, ...). Children are rendered after the icon's shapes.

The prop type is exported as EvIconProps, the component type as EvIconComponent.

Colour

Icons draw with currentColor. Set the CSS color of the icon or of a parent:

<StatusAvailable className="text-green-600" title="Available" />

absoluteStrokeWidth

By default the stroke scales with the icon: at size={12} a stroke of 1.5 is drawn 0.75 px wide. With absoluteStrokeWidth, every shape gets vector-effect="non-scaling-stroke", so the stroke is drawn strokeWidth screen pixels wide whatever the rendered size.

Because this is done by the browser and not computed from size, it also works when the size comes from CSS (size="1em", className="size-4", non-square sizes). Shapes you pass as children are not changed.

Small sizes

At 16 px the default stroke is drawn 1 px wide. Keep it at full weight with absoluteStrokeWidth and strokeWidth={1.5}, or with strokeWidth={2} when you do not use absoluteStrokeWidth. Next to Lucide icons (stroke 2), set strokeWidth={2} so both sets look equally heavy. This thickens the stroke relative to the drawing, so tight gaps such as the cut-out around the small bolt may close; check the icon at that size.

Not every icon is readable at 16 px. Use these from 20 px: the connector faces (category connector: plug-type-1, plug-type-2, plug-ccs1, plug-ccs2, plug-chademo, plug-nacs, plug-gbt-dc, plug-mcs, plug-schuko, plug-cee-blue, plug-cee-red), the letter icons (current-ac, current-dc, power-kw, parking-charging), bike-electric, motorcycle-electric and charging-availability. Use the map markers (marker-*) from 24 px.

Accessibility

Icons are decorative by default: the <svg> gets aria-hidden="true" and no role. Icons complement visible text; when an icon stands alone and carries meaning, give it an accessible name. As soon as it has one, aria-hidden is dropped and role="img" is set.

If several are given, this order applies:

  1. aria-labelledby (yours): kept as is.
  2. aria-label: used as the name. A title is still rendered as <title> but not referenced.
  3. title: rendered as the first child <title> with an id from React's useId (unique and stable in server rendering) and referenced with aria-labelledby.
  4. None of these: decorative (aria-hidden="true").

An explicit role or aria-hidden that you pass always wins over the defaults.

<StatusFaulted title="Faulted" />                    // role="img", named "Faulted"
<StatusFaulted aria-label="Charge point faulted" />  // role="img", named by aria-label
<StatusFaulted />                                    // aria-hidden="true"

Icons complement text

Do not use an icon as the only carrier of information. At 16 px the contacts of a connector face render as similar dots, so faces that share a part are hard to tell apart: plug-type-2 and plug-ccs2 differ only in the DC part below the Type 2 contacts, plug-type-1 and plug-ccs1 only in the DC pair below the Type 1 contacts. plug-gbt-dc differs from plug-type-2 mainly by the two large DC rings and the higher flat edge. Likewise plug-type-1, plug-chademo and plug-schuko look alike at 16 px (round faces), and plug-cee-blue resembles plug-type-1 (two contacts above a larger one; the CEE face has the key at the bottom). Always show the connector name next to the icon, for example "Type 2 · 22 kW". The same applies to status icons: show the status as text or at least as an accessible name.

Status overlay pattern

To combine a status with another icon, place a small status icon (half the base size, with absoluteStrokeWidth) absolutely in the bottom-right corner. See the example in the repository README.

Icons

Connectors

NameReact componentMeaning
plug-type-2PlugType2Type 2 connector (IEC 62196-2, "Mennekes"), shown as the vehicle inlet face; the GB/T 20234.2 AC inlet (China) has the same face
plug-ccs2PlugCcs2CCS Combo 2 connector (IEC 62196-3, Type 2 with two DC contacts), shown as the vehicle inlet face
plug-chademoPlugChademoCHAdeMO DC connector (IEC 62196-3 configuration AA, JEVS G105), shown as the vehicle inlet face
plug-schukoPlugSchukoSchuko socket (CEE 7/3, DIN 49440, household AC), shown as the socket face seen from the front
plug-type-1PlugType1Type 1 AC connector (SAE J1772, IEC 62196-2 Type 1; North America, Japan), shown as the vehicle inlet face
plug-ccs1PlugCcs1CCS Combo 1 connector (IEC 62196-3 configuration EE, SAE J1772 Type 1 with two DC contacts; North America), shown as the vehicle inlet face
plug-nacsPlugNacsNACS connector (SAE J3400, North American Charging Standard; AC and DC through the same two power contacts), shown as the vehicle inlet face
plug-gbt-dcPlugGbtDcGB/T DC connector (GB/T 20234.3, China; DC fast charging with the contacts DC+, DC−, PE, S+, S−, CC1, CC2, A+, A−), shown as the vehicle inlet face
plug-mcsPlugMcsMCS connector (Megawatt Charging System, SAE J3271 / IEC 63379; DC charging for trucks and buses with the contacts DC+, DC−, PE and four communication and detection contacts), shown as the vehicle inlet face
plug-cee-bluePlugCeeBlueCEE blue socket (IEC 60309-2, 2P+E, 230 V, 16/32 A, earth at 6 h; campsite or caravan socket), shown as the socket face seen from the front
plug-cee-redPlugCeeRedCEE red socket (IEC 60309-2, 3P+N+E, 400 V three-phase, 16 to 125 A, earth at 6 h), shown as the socket face seen from the front

Stations and sites

NameReact componentMeaning
charging-stationChargingStationCharging station: a public or private charge point for electric vehicles
charging-plugChargingPlugCharging plug in general, seen from the side with its cable (no specific connector type)
charging-cableChargingCableCharging cable attached to the charge point (tethered cable with plug, no own cable needed)
wallboxWallboxWallbox: a wall-mounted home charger for electric vehicles
home-chargingHomeChargingHome charging: charging the vehicle at home
parking-chargingParkingChargingCharging parking: a parking space where electric vehicles can charge
charging-operatorChargingOperatorCharge point operator (CPO): the company that runs a charging point
destination-chargingDestinationChargingDestination charging: charging while staying at a hotel, shop or restaurant
report-faultReportFaultReport a fault: tell the operator that a charging point has an electrical or technical problem
fuel-station-chargingFuelStationChargingFuel station charging: a charging point at a fuel or service station (under the canopy)
dealer-chargingDealerChargingCar dealer charging: a charging point at a car dealership, showroom or garage
shop-chargingShopChargingCharging while shopping: a charging point at a supermarket, shopping centre or retail car park
streetlight-chargingStreetlightChargingStreet light charging: a charging point built into a street light (kerbside charging)
charging-hubChargingHubCharging hub: a site with several charging points in one place (HPC hub, charging park)
highway-chargingHighwayChargingMotorway charging: charging on or next to a motorway (service area, rest stop)
accessible-chargingAccessibleChargingAccessible charging bay: a charging point usable from a wheelchair (step-free, wider bay, reachable controls)
charging-availabilityChargingAvailabilityCharging availability: how many charging points at a site are free or occupied
station-uptimeStationUptimeStation uptime: the operating status of a charging point over time, its reliability (for example availability over the last 30 days)
restricted-accessRestrictedAccessRestricted access: the charging point is not open to everyone (private, customers only, company vehicles only, behind a barrier)
community-verifiedCommunityVerifiedCommunity verified: information reported or confirmed by drivers (for example a price, a free charger or a tip)
register-verifiedRegisterVerifiedListed in an official charging point register, e.g. the national register kept by the regulator (data from the authority, not from users)
charging-socketChargingSocketCharging socket: the charging point has a socket outlet, bring your own cable (no tethered cable)

Power and energy

NameReact componentMeaning
current-acCurrentAcAlternating current (AC) charging
current-dcCurrentDcDirect current (DC) charging
fast-chargingFastChargingFast charging: high charging power, typically DC fast or high-power charging
charging-boltChargingBoltCharging or electricity in general (plain lightning bolt)
power-kwPowerKwPower in kilowatts (kW), for example the charging power of a charge point
solar-chargingSolarChargingSolar charging: charging with power from photovoltaics (PV surplus)
green-powerGreenPowerGreen power: electricity from renewable sources
battery-chargingBatteryChargingBattery charging: the vehicle battery is being charged
bidirectional-chargingBidirectionalChargingBidirectional charging: energy flows into and out of the vehicle (V2G, V2H)
charging-power-levelChargingPowerLevelCharging power level: the charging power shown on a scale (kW display, power filter)
charging-sessionChargingSessionCharging session in progress: the vehicle is charging right now (live session)
power-outagePowerOutagePower outage: no grid power at the site, the charging point has no electricity
charging-timeChargingTimeCharging time: how long a charging session takes, or a time-based tariff

Vehicles

NameReact componentMeaning
car-pluggedCarPluggedElectric car connected to a charging cable
car-electricCarElectricElectric car (battery electric vehicle)
driving-rangeDrivingRangeRange: distance the vehicle can drive on its battery charge
route-to-chargerRouteToChargerRoute to the charger: navigation to a charging point
truck-electricTruckElectricElectric truck: a battery electric goods vehicle (vehicle class N)
bus-electricBusElectricElectric bus: a battery electric bus or coach (vehicle class M2/M3)
bike-electricBikeElectricElectric bike: e-bike, pedelec or electric cargo bike (light electric vehicle)
motorcycle-electricMotorcycleElectricElectric motorcycle or electric scooter (vehicle class L, for example L1e and L3e)
plug-in-hybridPlugInHybridPlug-in hybrid (PHEV): a vehicle that charges from the grid and also runs on fuel

Payment

NameReact componentMeaning
charging-cardChargingCardCharging card: an RFID card that starts a charging session
app-chargingAppChargingCharging by app: start and pay a charging session with a smartphone app
card-terminalCardTerminalCard terminal: ad hoc payment by debit or credit card, contactless
roamingRoamingRoaming: charging with a contract from another provider
charging-tariffChargingTariffCharging tariff: the price of charging, for example per kWh
charging-logChargingLogCharging log: a record of charging sessions, for example a log book or receipt
calibrated-meterCalibratedMeterCalibrated meter: the charging point bills energy with a meter that complies with calibration law (Eichrecht)
free-chargingFreeChargingFree charging: charging at no cost to the driver
idle-feeIdleFeeIdle fee: a fee for occupying the charging point after charging has finished
qr-chargingQrChargingQR code charging: start or pay for a charging session ad hoc by scanning the QR code at the charging point
plug-and-chargePlugAndChargePlug & Charge: the vehicle authorises the charging session automatically when it is plugged in (ISO 15118)

Status

Status icons share a round frame; the sign inside carries the meaning.

NameReact componentSignMeaning
status-availableStatusAvailableHand holding a plugAvailable: the charge point is free and ready to charge
status-occupiedStatusOccupiedClockOccupied: the charge point is in use by another vehicle
status-faultedStatusFaultedExclamation markFaulted: the station reports an error and cannot charge
status-out-of-serviceStatusOutOfServiceCrossed-out plugOut of service: taken out of service by the operator (for example maintenance or closure), not an error report
status-reservedStatusReservedLetter RReserved: the charge point is reserved for a booking
status-unknownStatusUnknownQuestion markUnknown: no current status is available for the charge point
status-queueStatusQueueTwo cars, one behind the otherQueue: cars are queuing at this station; you would have to wait

"Faulted" (the station reports an error) and "out of service" (taken out of service by the operator) are different states; use the one your data actually reports.

Markers

Map pins with a sign in the head (the cluster pin leaves it empty for a count), for 24 to 40 px; see Map markers for filled mode.

The charging marker is named marker-charging (MarkerCharging), not marker, so that it does not clash with the Marker component of map libraries (MapLibre, Mapbox, Leaflet, Google Maps).

NameReact componentSignMeaning
marker-chargingMarkerChargingLightning boltMap marker for a charging point
marker-acMarkerAcLetters ACMap marker for an AC charging point
marker-dcMarkerDcLetters DCMap marker for a DC charging point
marker-availableMarkerAvailableCheck markMap marker: the charging point is available
marker-occupiedMarkerOccupiedClockMap marker: the charging point is occupied
marker-faultedMarkerFaultedExclamation markMap marker: the charging point reports an error and cannot charge
marker-out-of-serviceMarkerOutOfServiceCrossMap marker: the charging point is out of service
marker-unknownMarkerUnknownQuestion markMap marker: the status of the charging point is unknown
marker-queueMarkerQueueHourglassMap marker: drivers are queuing for the charging point, expect a wait
marker-reservedMarkerReservedLetter RMap marker: the charging point is reserved for a booking
marker-clusterMarkerClusterEmpty headMap marker for a cluster of charging points; the app draws the count in the head

Map markers

The first <path> of every marker-* icon is the pin, so markers can be drawn filled with CSS: the pin in your colour, the sign in white.

.marker svg > path:first-of-type { fill: currentColor; }
.marker svg > :not(path:first-of-type) { stroke: #fff; }
.marker svg > [fill] { fill: #fff; }

Use path:first-of-type, not :first-child: with title, the component renders a <title> as the first child. The third rule turns the solid bolt of marker-charging white: since 0.7.0 every lightning bolt is solid and carries fill="currentColor". For map libraries that draw images (MapLibre addImage), see the recipe in the repository README.

For a cluster, use marker-cluster, the empty pin, and draw the count in its head; for the selected station, draw its own marker larger (40 px instead of 32) and with a white ring, not only in another colour. The repository README shows both, for MapLibre, Leaflet and React, under Clusters and selection.

Compatibility

Supported
React18 and 19 (peer dependency ^18.0.0 || ^19.0.0)
Server renderingNode.js 20 or later (tested on 20 and 24); works in React Server Components, no 'use client' needed
Module formatESM only, no CommonJS build; require() works on Node.js versions with require(esm) (20.19+, 22.12+)
TypeScriptTypes included

License

MIT

版本与发布记录

@evicons/react 共发布 10 个版本,首次发布于 2026/11/02;过去 12 个月发布了 10 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.8.0latest2026/11/049 天前
0.7.02026/11/049 天前
0.6.02026/11/0410 天前
0.5.12026/11/0410 天前
0.5.02026/11/0410 天前
0.4.02026/11/0410 天前

关于 @evicons/react 的常见问题

@evicons/react 是什么?

EVicons React icon components for e-mobility and EV charging

如何安装 @evicons/react?

在项目目录运行 npm install @evicons/react,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:react(^18.0.0 || ^19.0.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@evicons/react 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@evicons/react 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@evicons/react 可以商用吗?

@evicons/react 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@evicons/react 的下载量有多少?

根据 npm 官方下载统计,@evicons/react 在 2026/10/14 – 2026/11/12 这 30 天内被下载 3,585 次,日均约 120 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@evicons/react 还在维护吗?

最新版本 0.8.0 发布于 2026/11/04(9 天前);至今共发布 10 个版本,其中过去 12 个月发布了 10 个;首次发布于 2026/11/02。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。