Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>react-classname-replacerNew to Visual Studio Code? Get it now.
react-classname-replacer

react-classname-replacer

Kumoyasu Dev

|
241 installs
| (0) | Free
Replaces regular react string classname with css module classname
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

react-classname-replacer

Features

This extension is useful in React projects that uses module css. It provides a direct way to convert string classNames to module css style. The famous classnames library is supported.

For example:

<div className="my-class">

Now will be converted to:

<div className={styles['my-class']}>

How to Use

  1. Position cursor around target className content.

  2. Right click and select Replace classname, or use keyboard shortcut:

  • For mac: ⌘K+R
  • For win: CtrlK+R

To specify a import name, right click and select Replace classname with..., or use keyboard shortcut:

  • For mac: ⌘K+T
  • For win: CtrlK+T

User Configurations

Prefix: react-classname-replacer.

Property Name Description Default
importModuleName Import Module Name The default import name of css modules as written in import xxx from 'styles.module.css styles
useClassnamesLib Use classnames Lib Whether the classnames library is in use - this will change the conversion when multiple classes are detected true
classnamesImportName Classnames Import Name The import name of classnames library as written in import xxx from 'classnames' cls

Known Issues

  • Cannot handle cross-line className conversions, so please make sure the content of a className property are all in the same line.

Release Notes

0.1.0

Initial version of the tool.

0.2.0

Support user configuration and classnames library.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft