UI-komponenttikirjaston luominen Storybook.js:n avulla
Suksia, Jesse (2025)
Julkaisun pysyvä osoite on
https://urn.fi/URN:NBN:fi:amk-2025121235457
https://urn.fi/URN:NBN:fi:amk-2025121235457
Tiivistelmä
Nykyaikainen ohjelmistokehitys nojaa vahvasti komponenttipohjaiseen arkkitehtuuriin, mikä on korostanut UI-komponenttikirjastojen strategista merkitystä
ohjelmistohankkeissa. Erityisesti organisaatioiden sisäisissä kirjastoissa merkittäviksi haasteiksi muodostuvat usein ylläpidettävyys, puutteellinen dokumentaatio ja testauksen vaikeus. Nämä ongelmat johtavat pahimmillaan kirjastojen tekniseen rappeutumiseen ja niiden alkuperäisen hyödyn menettämiseen. Tämän opinnäytetyön tavoitteena oli luoda malli, joka osoittaa, miten
laadukas, kattavasti dokumentoitu ja testattu UI-komponenttikirjasto voidaan
rakentaa kustannustehokkaasti pienillä resursseilla hyödyntämällä Storybook.js-työkalua.
Työ nojasi vahvasti Design System -ajatteluun, joka asetti raamit dokumentaation ja projektimäärittelyiden tärkeydelle. Design System -ajattelun, kuten
myös tämän opinnäytetyön, keskeisenä päämääränä oli tuottaa kirjasto, joka
toimii ns. ainoana totuuden lähteenä (Single Source of Truth). Tämä periaate
varmistaa, että kirjaston käyttö on yhdenmukaista, ennustettavaa ja luotettavaa kaikissa sitä hyödyntävissä projekteissa.
Opinnäytetyö toteutettiin kehittämistutkimuksena. Työssä rakennettiin Reactja TypeScript-pohjainen komponenttikirjasto, jonka perustana hyödynnettiin
MUI-kirjastoa. Kehitysympäristönä toimi Storybook, joka mahdollisti komponenttien eristetyn kehittämisen, visuaalisen dokumentoinnin ja automatisoidun
testaamisen. Työn aikana kehitettiin, testattiin ja dokumentoitiin kolme keskeistä käyttöliittymäkomponenttia: IconButton, Drawer ja NavBar.
Työn tuloksena syntyi toimiva ja tuotantokelpoinen komponenttikirjasto, jonka
testikattavuus saatiin nostettua sataan prosenttiin. Työ osoitti, että Storybook
toimii tehokkaana teknisenä ratkaisuna Design System -ajattelun jalkauttamisessa, sillä se ohjaa kehitysprosessia standardien mukaiseen työskentelyyn ja
yhdistää sujuvasti koodin ja sen dokumentaation. Keskeisenä johtopäätöksenä todettiin, että laadukas dokumentaatio ja koodin testattavuus ovat kriittisiä tekijöitä kirjaston uudelleenkäytettävyydelle. Modern software development relies heavily on component-based architecture, highlighting the strategic importance of UI component libraries in software projects. Especially within in-house libraries, significant challenges often
arise regarding maintainability, lack of documentation, and testing difficulties.
At worst, these issues lead to technical decay and the loss of the library's original value. The objective of this thesis was to create a model demonstrating
how a high-quality, comprehensively documented, and tested UI component
library can be built cost-effectively with limited resources by utilizing the Storybook.js tool.
The thesis relied heavily on Design System thinking, which set the framework
for the importance of documentation and project specifications. A central goal
of Design System thinking, as well as this thesis, was to produce a library that
functions as a Single Source of Truth. This principle ensures that the usage of
the library is consistent, predictable, and reliable in all projects utilizing it.
The thesis was carried out as development research. A React and TypeScriptbased component library was built, utilizing the MUI library as a foundation.
Storybook served as the development environment, enabling isolated component development, visual documentation, and automated testing. During the
process, three key UI components were developed, tested, and documented:
IconButton, Drawer, and NavBar.
The result of the work was a functional and production-ready component library, with test coverage raised to 100 percent. The work demonstrated that
Storybook acts as an effective technical solution for implementing Design System thinking, as it guides the development process towards standardized
workflows and seamlessly combines code with its documentation. The key
conclusion was that high-quality documentation and code testability are critical
factors for the library's reusability and lifecycle.
ohjelmistohankkeissa. Erityisesti organisaatioiden sisäisissä kirjastoissa merkittäviksi haasteiksi muodostuvat usein ylläpidettävyys, puutteellinen dokumentaatio ja testauksen vaikeus. Nämä ongelmat johtavat pahimmillaan kirjastojen tekniseen rappeutumiseen ja niiden alkuperäisen hyödyn menettämiseen. Tämän opinnäytetyön tavoitteena oli luoda malli, joka osoittaa, miten
laadukas, kattavasti dokumentoitu ja testattu UI-komponenttikirjasto voidaan
rakentaa kustannustehokkaasti pienillä resursseilla hyödyntämällä Storybook.js-työkalua.
Työ nojasi vahvasti Design System -ajatteluun, joka asetti raamit dokumentaation ja projektimäärittelyiden tärkeydelle. Design System -ajattelun, kuten
myös tämän opinnäytetyön, keskeisenä päämääränä oli tuottaa kirjasto, joka
toimii ns. ainoana totuuden lähteenä (Single Source of Truth). Tämä periaate
varmistaa, että kirjaston käyttö on yhdenmukaista, ennustettavaa ja luotettavaa kaikissa sitä hyödyntävissä projekteissa.
Opinnäytetyö toteutettiin kehittämistutkimuksena. Työssä rakennettiin Reactja TypeScript-pohjainen komponenttikirjasto, jonka perustana hyödynnettiin
MUI-kirjastoa. Kehitysympäristönä toimi Storybook, joka mahdollisti komponenttien eristetyn kehittämisen, visuaalisen dokumentoinnin ja automatisoidun
testaamisen. Työn aikana kehitettiin, testattiin ja dokumentoitiin kolme keskeistä käyttöliittymäkomponenttia: IconButton, Drawer ja NavBar.
Työn tuloksena syntyi toimiva ja tuotantokelpoinen komponenttikirjasto, jonka
testikattavuus saatiin nostettua sataan prosenttiin. Työ osoitti, että Storybook
toimii tehokkaana teknisenä ratkaisuna Design System -ajattelun jalkauttamisessa, sillä se ohjaa kehitysprosessia standardien mukaiseen työskentelyyn ja
yhdistää sujuvasti koodin ja sen dokumentaation. Keskeisenä johtopäätöksenä todettiin, että laadukas dokumentaatio ja koodin testattavuus ovat kriittisiä tekijöitä kirjaston uudelleenkäytettävyydelle.
arise regarding maintainability, lack of documentation, and testing difficulties.
At worst, these issues lead to technical decay and the loss of the library's original value. The objective of this thesis was to create a model demonstrating
how a high-quality, comprehensively documented, and tested UI component
library can be built cost-effectively with limited resources by utilizing the Storybook.js tool.
The thesis relied heavily on Design System thinking, which set the framework
for the importance of documentation and project specifications. A central goal
of Design System thinking, as well as this thesis, was to produce a library that
functions as a Single Source of Truth. This principle ensures that the usage of
the library is consistent, predictable, and reliable in all projects utilizing it.
The thesis was carried out as development research. A React and TypeScriptbased component library was built, utilizing the MUI library as a foundation.
Storybook served as the development environment, enabling isolated component development, visual documentation, and automated testing. During the
process, three key UI components were developed, tested, and documented:
IconButton, Drawer, and NavBar.
The result of the work was a functional and production-ready component library, with test coverage raised to 100 percent. The work demonstrated that
Storybook acts as an effective technical solution for implementing Design System thinking, as it guides the development process towards standardized
workflows and seamlessly combines code with its documentation. The key
conclusion was that high-quality documentation and code testability are critical
factors for the library's reusability and lifecycle.
