Skip to content

Components

Contribute to the Ui component library

  1. Set up your development environment
  2. Read about the architecture of the Funkwhale frontend codebase and its specific challenges
  3. Make sure to follow our code style to keep the codebase consistent

Principles

  • A11y centric Ui components: At the center of each component is the interface (props, v-model, imports and exports). The naming of props, attributes, etc. follows the semantic model of standard HTML and aria attributes. Again, this allows authors to use the same attributes on normal HTML nodes as on Funkwhale Ui components.

  • Focus on composability and locality: Instead of highly capable components, much of the the functionality (visual variant, routing, icons, badges and other affordances) are composed by the author explicitly, favoring locality over DRY. In addition, headless components <Sync> and <Map> allow users to scope state and data transformations inside a template node.

  • Coupling with the design system: The library relies on design system attributes exposed through ~/ui/attributes.ts. Use the classes, variables and attributes defined in ~/ui/fw.css.

Component categories

  1. Data scoping (Sync, Map)
  2. Semantic Html tags: H1, Section
  3. Action controls: Link, Button
  4. Interactive controls: Toggle, Switch, Input, ImageInput, Slider
  5. Static layouts: Card, Toolbar, Alert, Marquee, Table
  6. Dynamic containers: Menu, Modal, Toc, Tokens, Nav, Tooltip, Label
  7. Helpers: Gap, Markdown, Badge, Icon (via iconify )

Adding new UI components

Choosing a UX pattern to implement

✔ I am using the same pattern in many different places in the app, and repeating it is error-prone

✔ The pattern is not coupled with a specific feature (such as API types, routing, ...)

✔ It's a conventional UI pattern and it fits into one of the seven categories listed above

Step by step

Make sure to avoid unnecessary barriers to funkwhale users [MDN] and keep them accessible.

Fixing bugs

  • Use your browser's Dev tools (F12; Ctrl+Shift+F) to inspect rendered elements and find the origin of styles
  • Fix errors at the root where possible instead of adding overrides and exceptions
  • Avoid deep cascades of abstraction and overrides