Pascal Case, Camel Case, Kebab Case & Snake Case

In Lightning Web Component, we need to maintain the case for Class Name, Variable Name, Component Name etc.
Before going to describe, we need to focus on the respective cases.

Camel Case: Each word in the middle of the respective phrase begins with a capital letter.

Pascal Case: It is a subset of Camel Case where first letter always is capitalized.

Kebab Case: Respective phrase will be transferred to all lowercase with hyphen(-) separating words.

Snake Case: Respective phrase will be separated with underscore(_), no spaces, initial letter with lowercase and first letter with lowercase or uppercase.

So, we will check each case with this phrase “welcomeWindow“.

Camel CasePascal CaseKebab CaseSnake Case
welcomeWindowWelcomeWindowwelcome-windowwelcome_window
Generally, it's used in variable names.Generally, it's used in class names.At the time of component rendering or calling a component or set attribute name from other component in LWC, kebab case is used.Generally, it's used in C/Python language.

22,161 total views, 6 views today

Rating: 4.3/5. From 12 votes.
Please wait...
This entry was posted in Lightning Web Component. Bookmark the permalink.

Leave a Reply