Component file structure
Component directories follow by BEM file structure organization and contains all files of component.
Below presented typical file structure of components, in fact a block may have not some components or have unlisted here components, for clarification see to docs for specific component.
File structure
ComponentName.tsx
- basic component (block)__examples__
- directory with examples a usage of componentsComponentName@platform.tsx
- basic platform-specific version of component that extends a basic component_modName
- directory of boolean modifier with namemodName
ComponentName_modName.css
- styles of modComponentName_modName.tsx
- declaration of mod
_otherModName
- directory of key-value modifier with nameotherModName
ComponentName_otherModName_value1.css
- styles of mod with valuevalue1
ComponentName_otherModName_value1.tsx
- declaration of mod with valuevalue1
ComponentName_otherModName_value2.css
- styles of mod with valuevalue2
ComponentName_otherModName_value2.tsx
- declaration of mod with valuevalue2
ElementName
- directory of element with nameElementName
_modName
- directory of boolean modifier with namemodName
for elementElementName
ElementName_modName.css
- styles of modElementName_modName.tsx
- declaration of mod
ElementName.css
- styles of elementElementName.tsx
- declaration of element
ComponentName.assets
- directory with resources of components, such as images, fonts, etc.ComponentName.bundle
- directory with composed components with all features, named by patternplatform.tsx
platform.ts
- contains composed component for a specific platform
ComponentName.docs
- directory with additional docsComponentName.hocs
- directory with High Order Components for this blockComponentName.registry
- directory for DI filesindex.ts
- contains only registry interface, without implementationplatform.ts
- contains registry object for a specific platform
ComponentName.tests
- directory with tests of componentComponentName.tokens
- directory with design tokens for component
Under platform.tsx
meaning name for specific platform, for example desktop.tsx
, mobile.tsx
or touch.tsx
.
Here displays file structure examples of source, therefore used .ts
and .tsx
files, but package contains compiled .js
files with .d.ts
headers.