### Card Component with Tags and Image (HTML)
Source: https://punkt.oslo.kommune.no/latest/komponenter-og-maler/komponenter/card
A basic implementation of the Card component using HTML. It includes example data for tags and an image, demonstrating how to structure content within the card. This snippet is platform-agnostic and serves as a structural example.
```html
Dette er en tekst om barnehagen
```
--------------------------------
### Install and Run axe-cli for WCAG Testing
Source: https://punkt.oslo.kommune.no/latest/universell-utforming/testverktoy
This snippet demonstrates how to install the axe-cli tool globally using npm and then run it against a local development server to test specified pages for WCAG compliance. It also shows an example of the output when a violation is found.
```shell
$ npm install @axe-core/cli -g
```
```shell
$ axe http://localhost:3000 http://localhost:3000/komponenter/badge
```
```text
Violation of "landmark-no-duplicate-banner" with 1 occurrences!
Ensures the document has at most one banner landmark. Correct invalid elements at:
- #pkt-header
For details, see: https://dequeuniversity.com/rules/axe/4.4/landmark-no-duplicate-banner
```
--------------------------------
### PktIcon Component Example
Source: https://punkt.oslo.kommune.no/latest/komponenter-og-maler/komponenter/icon
An example of how to use the PktIcon component, likely within a web framework. This snippet demonstrates the basic structure for rendering an icon, with 'content' likely referring to the specific icon identifier.
```html
Kodebygger
PktIcon
Innhold
```
--------------------------------
### Web Component Messagebox
Source: https://punkt.oslo.kommune.no/latest/komponenter-og-maler/komponenter/messagebox
Example of using the Messagebox as a web component. This is a framework-agnostic way to implement the component, useful for plain HTML or other JavaScript frameworks. It allows for similar customization as the React version.
```html
Dette er innholdet i meldingsboksen.
```
--------------------------------
### Default Text Styling Examples (HTML)
Source: https://punkt.oslo.kommune.no/latest/grunnleggende/ressurser/typografi
Provides examples of basic HTML text elements and their default styling within the Punkt CSS framework, including paragraphs, italic, small text, bold text.
```html
Dette er vanlig brødtekst.
Dette er skrevet i kursiv .
Dette er skrevet i liten tekst .
Dette er skrevet i fet tekst .
```
--------------------------------
### Punkt Spacing CSS Helper Classes Examples
Source: https://punkt.oslo.kommune.no/latest/grunnleggende/ressurser/spacing
Demonstrates the usage of Punkt's CSS helper classes for applying responsive margins and padding. These classes follow a pattern of {type}{direction}-{size} and can include responsive modifiers like --{breakpoint}-up.
```html
Margin bunn
margin høyre og padding topp
Horisontal padding
```
--------------------------------
### Configure Responsive Gap/Gutter Sizes in Punkt Grid
Source: https://punkt.oslo.kommune.no/latest/grunnleggende/ressurser/grid
Shows how to manage responsive gap and gutter sizes within the `pkt-grid`. This example applies a 16px gap for mobile and increases it to 32px for tablets and larger screens using classes like `pkt-grid--gap-size-16` and `pkt-grid--gap-size-32-tablet-up`.
```html
.pkt-grid--gap-size-16 pkt-grid--gap-size-32-tablet-up
.pkt-grid--gap-size-16 pkt-grid--gap-size-32-tablet-up
.pkt-grid--gap-size-16 pkt-grid--gap-size-32-tablet-up
.pkt-grid--gap-size-16 pkt-grid--gap-size-32-tablet-up
```
--------------------------------
### Implement Punkt Grid with Phablet Breakpoint
Source: https://punkt.oslo.kommune.no/latest/grunnleggende/ressurser/grid
Demonstrates the basic implementation of the `pkt-grid` component using the `pkt-grid--phablet` class. This sets up a grid layout that is responsive and adapts to different screen sizes, starting with a phablet breakpoint. The content scales with screen width, while gaps and margins remain consistent.
```html
```
--------------------------------
### Progressbar Implementation in HTML
Source: https://punkt.oslo.kommune.no/latest/komponenter-og-maler/komponenter/progressbar
Shows the implementation of the progress bar using custom HTML elements. This example uses the 'pkt-progressbar' tag with attributes to define the title, minimum and maximum values, current value, and status type.
```html
```
--------------------------------
### PktTextinput Component Example - React
Source: https://punkt.oslo.kommune.no/latest/komponenter-og-maler/komponenter/textinput
This code snippet demonstrates how to use the PktTextinput component in React. It shows basic configuration with a label, name, placeholder, help text, input type, ID, and wrapper usage. The component is designed for text input with optional helper text and validation.
```jsx
```
--------------------------------
### Import PktInputWrapper i React
Source: https://punkt.oslo.kommune.no/latest/komponenter-og-maler/komponenter/inputwrapper
Dette kodeeksemplet viser hvordan du importerer PktInputWrapper-komponenten fra Punkt React-biblioteket. Dette er nødvendig for å bruke komponenten i React-applikasjoner.
```javascript
import { PktInputWrapper } from '@oslokommune/punkt-react';
```
--------------------------------
### Import PktInputWrapper i Vanilla JS
Source: https://punkt.oslo.kommune.no/latest/komponenter-og-maler/komponenter/inputwrapper
Dette kodeeksemplet viser hvordan du importerer PktInputWrapper-komponenten for bruk i vanilje JavaScript-prosjekter ved hjelp av Punkt Elements JS-modulen. Sørg for at filstien til .js-filen er korrekt.
```javascript
import @oslokommune/punkt-elements/dist/pkt-input-wrapper.js;
```
--------------------------------
### Installere og bruke Punkt Elements (Web Components)
Source: https://punkt.oslo.kommune.no/latest/grunnleggende/for-utviklere/kom-i-gang
Installerer Punkt Elements-pakken og demonstrerer import og bruk av Web Components for tekstinput og knapper direkte i HTML. Anbefaler innpakking av reaktivt innhold.
```bash
npm add @oslokommune/punkt-elements
```
```javascript
import @oslokommune/punkt-elements/dist/pkt-textinput.js;
import @oslokommune/punkt-elements/dist/pkt-button.js;
```
```html
Dette er en knapp
```
--------------------------------
### Import Loader Component (React)
Source: https://punkt.oslo.kommune.no/latest/komponenter-og-maler/komponenter/loader
This snippet demonstrates how to import the PktLoader component for use within a React application. It assumes the '@oslokommune/punkt-react' package is installed.
```javascript
import { PktLoader } from '@oslokommune/punkt-react';
```
--------------------------------
### Alert Component - Implementation
Source: https://punkt.oslo.kommune.no/latest/komponenter-og-maler/komponenter/alert
Provides guidance on how to implement the Alert component using code, including options and testing.
```APIDOC
## Implementation in Code
### Options
Alerts can accept a JSON list as an attribute/prop in `options`, or a series of `` elements. Use a JSON list if `options` are dynamic or if using `tagSkinColor`, `description`, or `prefix`. `options` are always converted to an array of objects.
### Usage
**Elements:**
```javascript
import "@oslokommune/punkt-elements/dist/pkt-alert.js";
```
**React:**
```javascript
import { PktAlert } from '@oslokommune/punkt-react';
```
**CDN:**
```html
```
### Testing
For testing with JSDOM or similar, ensure the component is fully rendered before testing. Use:
```javascript
await window.customElements.whenDefined("pkt-alert");
```
Testing tools in `punkt-testing-utils` may handle this automatically.
```
--------------------------------
### Installere og bruke Punkt React-komponenter
Source: https://punkt.oslo.kommune.no/latest/grunnleggende/for-utviklere/kom-i-gang
Installerer Punkt React-pakken og viser et eksempel på hvordan man importerer og bruker React-komponenter som knapper og input-felt. Merk at React-komponenter kan kreve spesifikk håndtering i enhetstester.
```bash
npm add @oslokommune/punkt-react
```
```javascript
import { PktButton, PktInput } from "@oslokommune/punkt-react";
...
Testbutton
```
--------------------------------
### Override Fetch Function for Custom Icon Loading
Source: https://punkt.oslo.kommune.no/latest/komponenter-og-maler/komponenter/icon
Provides an example of overriding the global fetch function to control how icons are loaded, useful for testing.
```javascript
window.pktFetch = () =>
Promise.resolve({
ok: true,
text: () => Promise.resolve('FakeIcon
'),
});
```
--------------------------------
### Import Stepper Component in React
Source: https://punkt.oslo.kommune.no/latest/komponenter-og-maler/komponenter/stepper
This code snippet demonstrates how to import the PktStepper component from the '@oslokommune/punkt-react' library in a React application. Ensure you have the library installed as a dependency.
```javascript
import { PktStepper } from '@oslokommune/punkt-react';
```
--------------------------------
### Inkluder PktInputWrapper via CDN
Source: https://punkt.oslo.kommune.no/latest/komponenter-og-maler/komponenter/inputwrapper
Dette kodeeksemplet viser hvordan du inkluderer PktInputWrapper-komponenten i et HTML-dokument ved hjelp av en CDN-lenke. Dette er en enkel måte å ta komponenten i bruk uten en byggeprosess.
```html
```
--------------------------------
### Import Punkt React Components
Source: https://punkt.oslo.kommune.no/latest/komponenter-og-maler/komponenter/accordion
Import the PktAccordion and PktAccordionItem components for use within a React application. This assumes you have the Punkt React library installed.
```javascript
import { PktAccordion, PktAccordionItem } from '@oslokommune/punkt-react';
```
--------------------------------
### Import PktSelect Component (React)
Source: https://punkt.oslo.kommune.no/latest/komponenter-og-maler/komponenter/select
This snippet shows the import statement for the 'PktSelect' component within a React application. It assumes the '@oslokommune/punkt-react' library is installed.
```javascript
import { PktSelect } from '@oslokommune/punkt-react';
```
--------------------------------
### Input wrapper i HTML
Source: https://punkt.oslo.kommune.no/latest/komponenter-og-maler/komponenter/inputwrapper
Viser hvordan Input wrapper-komponenten brukes i ren HTML. Den omslutter inputfelt med standard etikett, hjelpetekst og innhold for konsistent visning.
```html
Her kan du skrive inn tekst
```
--------------------------------
### Import Button Component - React
Source: https://punkt.oslo.kommune.no/latest/komponenter-og-maler/komponenter/button
Demonstrates how to import and use the Button component within a React application. This assumes the necessary package is installed in the project.
```jsx
import { PktButton } from '@oslokommune/punkt-react';
```
--------------------------------
### PktCard Component Structure (HTML)
Source: https://punkt.oslo.kommune.no/latest/komponenter-og-maler/komponenter/card
Demonstrates the basic HTML structure for the PktCard component, including slots for heading, subheading, metadata, and links.
```html
Overskrift
Undertittel
Forfatter eller annen metadata
Dato eller annen metadata
Lenke for klikkbart card
```
--------------------------------
### HTML Accordion Implementation with Details and Summary
Source: https://punkt.oslo.kommune.no/latest/komponenter-og-maler/komponenter/accordion
Demonstrates the basic HTML structure for an accordion component using the semantic `` and `` elements. This approach provides built-in keyboard navigation and accessibility features. The content within `` is revealed when the `` is activated.
```html
Overskrift for rad 1
Innhold for rad 1. Dette er en kort og konsis beskrivelse.
Overskrift for rad 2
Innhold for rad 2. Mer informasjon som logisk hører sammen.
```
--------------------------------
### Importing PktTextinput in React
Source: https://punkt.oslo.kommune.no/latest/komponenter-og-maler/komponenter/textinput
This snippet shows how to import the PktTextinput component from the '@oslokommune/punkt-react' library for use in a React project. Ensure the library is installed in your project.
```javascript
import { PktTextinput } from '@oslokommune/punkt-react';
```
--------------------------------
### PktModal Component - Testing
Source: https://punkt.oslo.kommune.no/latest/komponenter-og-maler/komponenter/modal
Guidance on how to properly test the PktModal component, especially when using JSDOM or similar environments, to ensure it renders correctly.
```APIDOC
## PktModal Component - Testing
### Description
This section provides essential information for testing the `PktModal` component, particularly when using headless browser environments like JSDOM. It highlights the importance of waiting for the custom element to be fully defined before proceeding with tests.
### Method
Asynchronous testing with `customElements.whenDefined`
### Endpoint
`window.customElements.whenDefined("pkt-modal")`
### Parameters
(No specific parameters for the testing method itself)
### Request Example
```javascript
// Ensure the custom element is defined before running tests
await window.customElements.whenDefined("pkt-modal");
// Now you can proceed with your JSDOM or other environment tests
// For example, checking if the modal element exists and its content.
```
### Response
(This is a utility function for testing; it doesn't return a value but ensures the component is ready for interaction and inspection.)
**Note**: If you are using the testing utilities provided within `punkt-testing-utils`, this `whenDefined` call might be handled automatically.
```
--------------------------------
### Import PktSearchInput Component in React
Source: https://punkt.oslo.kommune.no/latest/komponenter-og-maler/komponenter/searchinput
This snippet shows how to import the PktSearchInput component from the @oslokommune/punkt-react library into a React project. Ensure the library is installed as a dependency.
```javascript
import { PktSearchInput } from '@oslokommune/punkt-react';
```
--------------------------------
### Import PktTable React Component
Source: https://punkt.oslo.kommune.no/latest/komponenter-og-maler/komponenter/table
This snippet shows how to import the PktTable component from the '@oslokommune/punkt-react' library. Ensure this package is installed in your React project to use the table component.
```javascript
import { PktTable } from '@oslokommune/punkt-react';
```
--------------------------------
### Import PktCheckbox Component using React
Source: https://punkt.oslo.kommune.no/latest/komponenter-og-maler/komponenter/checkbox
This snippet shows the import statement for the PktCheckbox component when using it within a React project. It assumes you have installed the @oslokommune/punkt-react package.
```javascript
import { PktCheckbox } from '@oslokommune/punkt-react';
```
--------------------------------
### Konfigurer Git Hooks
Source: https://punkt.oslo.kommune.no/latest/grunnleggende/for-utviklere/bidra
Dette snippetet viser hvordan man konfigurerer Git hooks for å automatisk kjøre scripts ved commits. Dette er viktig for å sikre at kodekvalitet og dokumentasjon oppdateres konsistent.
```bash
git config core.hooksPath scripts/git-hooks
```
--------------------------------
### Import Punkt Link Component (React)
Source: https://punkt.oslo.kommune.no/latest/komponenter-og-maler/komponenter/link
This code snippet shows how to import the PktLink component from the Punkt React library for use in React applications. Ensure the library is installed as a dependency.
```javascript
import { PktLink } from '@oslokommune/punkt-react';
```
--------------------------------
### Apply Icon Sizes with CSS Classes
Source: https://punkt.oslo.kommune.no/latest/komponenter-og-maler/komponenter/icon
Demonstrates how to apply predefined CSS classes to change the size of the PktIcon component.
```html
```
--------------------------------
### Utviklingsmiljø Kommandoer
Source: https://punkt.oslo.kommune.no/latest/grunnleggende/for-utviklere/bidra
En samling av vanlige npm-kommandoer for å administrere utviklingsmiljøet i et Lerna-basert monorepo. Disse kommandoene brukes for bygging, testing, og kjøring av dev-servere for ulike pakker som CSS og React-komponenter.
```bash
npm run build
npm run dev-css
npm run dev-docs
npm run dev-react
npm run svgo
npm run test-react
npm run test-testutils
npm run watch-css
```
--------------------------------
### Importing Punkt Elements Messagebox (React)
Source: https://punkt.oslo.kommune.no/latest/komponenter-og-maler/komponenter/messagebox
Demonstrates how to import the Messagebox component from the Punkt Elements library for use in a React project. Ensure the library is installed in your project's dependencies.
```javascript
import { PktMessagebox } from '@oslokommune/punkt-react';
```
--------------------------------
### Create Link with Content and URL - PktLink Component
Source: https://punkt.oslo.kommune.no/latest/komponenter-og-maler/komponenter/link
This component allows for the creation of links with specified content and a target URL. It offers options for controlling the link's appearance and text.
```html
```
--------------------------------
### Elements React CDN: Importere PktBackLink
Source: https://punkt.oslo.kommune.no/latest/komponenter-og-maler/komponenter/backlink
Instruksjoner for å importere PktBackLink-komponenten via CDN for bruk i React-applikasjoner. Dette gir tilgang til komponenten uten behov for npm-installasjon.
```javascript
import { PktBackLink } from '@oslokommune/punkt-react';
```
--------------------------------
### React Messagebox Component
Source: https://punkt.oslo.kommune.no/latest/komponenter-og-maler/komponenter/messagebox
Example of how to use the Messagebox component in React. It displays a title and content within a styled box. This component helps group information without requiring user interaction.
```jsx
Dette er innholdet i meldingsboksen.
```
--------------------------------
### Controlled Accordion Item State (Web Components)
Source: https://punkt.oslo.kommune.no/latest/komponenter-og-maler/komponenter/accordion
Example of controlling the open/closed state of AccordionItems in native JavaScript. This approach manually manages the `isOpen` state and prevents default behavior to ensure consistent UI updates.
```javascript
this.toggleCurrentOpenItem(e, item.id)}
>
${item.content}
Element innhold
```
--------------------------------
### Bruke PktIcon-komponenten for ikoner
Source: https://punkt.oslo.kommune.no/latest/ikoner
Illustrerer hvordan man bruker PktIcon-komponenten for å vise ikoner i applikasjoner. Denne komponenten er en del av Punkt-biblioteket og krever at du importerer den først.
```javascript
import PktIcon from "@/components/icon.vue";
// Bruk i template:
```
--------------------------------
### Tabs Component Anatomy Example (HTML)
Source: https://punkt.oslo.kommune.no/latest/komponenter-og-maler/komponenter/tabs
Demonstrates the structural elements of a tab component, including active and inactive tabs, titles, optional tags and icons, and separators. This is a visual representation of the component's anatomy.
```html
```
--------------------------------
### Vente på Rendering i Tester (JSDOM)
Source: https://punkt.oslo.kommune.no/latest/komponenter-og-maler/komponenter/card
En kodelinje for å sikre at PktCard-komponenten er ferdig rendret før tester utføres med JSDOM.
```javascript
await window.customElements.whenDefined("pkt-card");
```
--------------------------------
### Inkluder PktCard via Script Tag
Source: https://punkt.oslo.kommune.no/latest/komponenter-og-maler/komponenter/card
Legg til PktCard-komponenten i HTML-dokumentet ved å bruke en script-tag som peker til CDN-ressursen.
```html
```
--------------------------------
### Import PktCheckbox Component using ES Modules
Source: https://punkt.oslo.kommune.no/latest/komponenter-og-maler/komponenter/checkbox
This snippet demonstrates how to import the PktCheckbox component when using ES Modules in your JavaScript project. It assumes you have installed the necessary package via npm or a similar package manager.
```javascript
import @oslokommune/punkt-elements/dist/pkt-checkbox.js;
```
--------------------------------
### Implement Combobox with Web Components
Source: https://punkt.oslo.kommune.no/latest/komponenter-og-maler/komponenter/combobox
Eksempel på bruk av pkt-combobox web-komponenten. Denne komponenten tilbyr lignende funksjonalitet som React-varianten, inkludert søkefiltrering, fritekstinput og valg av alternativer, men implementert som en ren web-komponent.
```html
```
--------------------------------
### Alert Component Implementation in Web Components
Source: https://punkt.oslo.kommune.no/latest/komponenter-og-maler/komponenter/alert
Shows how to use the Alert component as a custom HTML element (web component). This approach is framework-agnostic and demonstrates the same functionality as the React example using standard HTML attributes.
```html
Dette er innholdet i meldingen.
```
--------------------------------
### Testing: Venter på definisjon av webkomponent
Source: https://punkt.oslo.kommune.no/latest/komponenter-og-maler/komponenter/backlink
En kodelinje som sikrer at webkomponenten 'pkt-backlink' er fullstendig lastet og definert før testing starter. Dette er viktig for å unngå feil i tester som bruker JSDOM eller lignende.
```javascript
await window.customElements.whenDefined("pkt-backlink");
```
--------------------------------
### Web Component Button with Icon and Text
Source: https://punkt.oslo.kommune.no/latest/komponenter-og-maler/komponenter/button
This web component code snippet shows the usage of the pkt-button element. It mirrors the React example, displaying an icon on the left and text, configured with primary skin, large size, and 'icon-left' variant.
```html
Dette er en knapp
```
--------------------------------
### Importer PktCard med Punkt React
Source: https://punkt.oslo.kommune.no/latest/komponenter-og-maler/komponenter/card
Importer PktCard-komponenten fra @oslokommune/punkt-react biblioteket for bruk i React-applikasjoner.
```javascript
import { PktCard } from '@oslokommune/punkt-react';
```
--------------------------------
### Controlled Accordion Item State (React)
Source: https://punkt.oslo.kommune.no/latest/komponenter-og-maler/komponenter/accordion
Manage the open/closed state of AccordionItems in React using local state. This example demonstrates how to handle clicks and prevent default behavior for consistent state management, especially when dealing with the underlying `` element.
```javascript
const [openedItem, setOpenedItem] = useState('')
const toggleCurrentOpenItem = (e: React.MouseEvent, id: string) => {
if (openedItem.includes(id)) {
setOpenedItem('')
} else {
setOpenedItem(id)
}
}
return (
{accordionItems.map((item, index) => {
return (
toggleCurrentOpenItem(e, item.id)}
>
{item.content}
);
})}
)
```
--------------------------------
### Import Link Card Component (React)
Source: https://punkt.oslo.kommune.no/latest/komponenter-og-maler/komponenter/linkcard
Slik importerer du PktLinkCard-komponenten fra @oslokommune/punkt-react-biblioteket for bruk i React-applikasjoner.
```javascript
import { PktLinkCard } from '@oslokommune/punkt-react';
```
--------------------------------
### Import Punkt Textarea - CDN
Source: https://punkt.oslo.kommune.no/latest/komponenter-og-maler/komponenter/textarea
How to import the PktTextarea component using a CDN link for direct use in HTML.
```html
```
--------------------------------
### Loading PktTextinput from CDN
Source: https://punkt.oslo.kommune.no/latest/komponenter-og-maler/komponenter/textinput
This snippet demonstrates how to load the `pkt-textinput.js` component from a CDN using a script tag. This method is suitable for projects that do not use a module bundler or for quick integration.
```html
```
--------------------------------
### Input wrapper i React
Source: https://punkt.oslo.kommune.no/latest/komponenter-og-maler/komponenter/inputwrapper
Viser hvordan Input wrapper-komponenten brukes i React. Den omslutter inputfelt med standard etikett, hjelpetekst og innhold for konsistent visning.
```jsx
Her kan du skrive inn tekst
```
--------------------------------
### Vue Form State Management and Validation Example
Source: https://punkt.oslo.kommune.no/latest/komponenter-og-maler/maler/skjema-mal
This Vue code snippet demonstrates form state management and input validation for fields like address, postal code, and city. It utilizes Vue's reactivity system and component-based structure to handle user input, error states, and display relevant error messages. Dependencies include Vue.js and potentially a UI component library like Pkt.
```vue
Mal for skjema
Dette er en mal for et skjema. Kun adresse, postnr, poststed og spørsmålet
om transportmiddel har validering. Dette er kun for å vise et eksempel på
hvordan de kan valideres. ✨
Påmelding til fjelltur
Meld deg på bedriftsidrettslagets årlige fjelltur til Rondane.
Påmeldingsskjemaet har 5 steg, og det tar 3-4 minutter å fylle det ut.
Du kan melde deg på turen dersom du
har vært fast ansatt i Oslo kommune i mer enn 1 år
ikke er redd for høyder
har godt humør
For å fylle ut skjemaet trenger du dokumentasjon som viser hvor lenge du
har vært ansatt i Oslo kommune
Informasjon om deg
setAddress(event.target.value)"
@blur="(event) => setAddressError(!isAddressValid(event.target.value))"
v-model="address"
errorMessage="Adressen du har skrevet er ikke gyldig. Skriv adressen på nytt."
:hasError="hasAddressError"
/>
setPostalCode(event.target.value)"
@blur="(event) => setPostalCodeError(!isPostalCodeValid(event.target.value))"
v-model="postalCode"
/>
setPostalArea(event.target.value)"
@blur="(event) => setPostalAreaError(!isPostalAreaValid(event.target.value))"
v-model="postalArea"
/>
Postnummeret er ikke gyldig. Du må skrive et postnummer med 4 tegn.
```
--------------------------------
### Installere og inkludere Punkt CSS
Source: https://punkt.oslo.kommune.no/latest/grunnleggende/for-utviklere/kom-i-gang
Installasjon av Sass og Punkt CSS-pakker for bruk i prosjekter. Inkluderer hvordan man setter opp font-stier og importerer Punkts stiler ved bruk av SCSS.
```bash
npm add -D sass
npm add @oslokommune/punkt-assets
npm add @oslokommune/punkt-css
```
```scss
/* Overstyr stien til fontene. */
@use "@oslokommune/punkt-css/dist/scss/abstracts/variables" with (
$font-path: "@oslokommune/punkt-assets/dist"
);
/* Hent inn Punkts stiler */
@use "@oslokommune/punkt-css/dist/scss/pkt";
```
--------------------------------
### Import Punkt Icon Component (Elements)
Source: https://punkt.oslo.kommune.no/latest/komponenter-og-maler/komponenter/icon
How to import the PktIcon component for use in web projects using the Elements library via CDN.
```javascript
import @oslokommune/punkt-elements/dist/pkt-icon.js;
```
--------------------------------
### Bruke Oslologoen fra npm-pakken
Source: https://punkt.oslo.kommune.no/latest/grunnleggende/ressurser/oslologo
Dette kodeeksempelet viser hvordan du kan inkludere Oslo kommunes offisielle logo i et HTML-dokument ved å bruke en SVG-fil fra npm-pakken '@oslokommune/punkt-assets'. Sørg for at pakken er installert i prosjektet ditt.
```html
```
--------------------------------
### Importer PktCard med Elements CDN
Source: https://punkt.oslo.kommune.no/latest/komponenter-og-maler/komponenter/card
Slik importerer du PktCard-komponenten ved hjelp av CDN-lenken for punkt-elements.
```javascript
import @oslokommune/punkt-elements/dist/pkt-card.js;
```
--------------------------------
### Simple Footer Props
Source: https://punkt.oslo.kommune.no/latest/komponenter-og-maler/komponenter/footer
Configuration options for the simple footer component.
```APIDOC
### Footer Simple
Prop| Type| Beskrivelse
---|---|---
`**personvernOgInfoLink**`| `string`| Link to personvern og info page
`**tilgjengelighetLink**`| `string`| Link to tilgjengelighet page
`**includeConsent**`| `boolean`| Whether to include Consent component in the footer
`**googleAnalyticsId**`| `string`| Google Analytics ID for tracking when using Consent component
`**hotjarId**`| `string`| Hotjar ID for tracking when using Consent component
`**links**`| `array`| Array of links for the footer
```
--------------------------------
### PktModal Component - React Implementation
Source: https://punkt.oslo.kommune.no/latest/komponenter-og-maler/komponenter/modal
Instructions for integrating the PktModal component within a React application using the dedicated React package.
```APIDOC
## PktModal Component - React Implementation
### Description
This section guides you on how to use the `PktModal` component in your React projects. It assumes you have installed the `@oslokommune/punkt-react` package.
### Method
React component import and usage
### Endpoint
`@oslokommune/punkt-react` package
### Parameters
(Component props are listed below in the 'Props and Tokens' section)
### Request Example
```jsx
import { PktModal } from '@oslokommune/punkt-react';
function MyComponent() {
return (
Content for the React modal.
Action Button
);
}
```
### Response
(The `PktModal` component renders a modal UI element.)
```
--------------------------------
### SCSS Breakpoint-variabler for Responsivt Design
Source: https://punkt.oslo.kommune.no/latest/grunnleggende/for-utviklere/bidra
Dette SCSS-kodeeksemplet definerer en Sass map for breakpoints, som er essensielt for responsivt webdesign. Variablene gir en standardisert måte å håndtere skjermstørrelser på tvers av prosjektet.
```scss
/* abstracts/variables/_breakpoints.scss */
$breakpoints: (
"mobile": 0,
"phablet": 36rem /* ~576px */,
"tablet": 48rem /* ~768px */,
"tablet-big": 64rem /* ~1024px */,
"laptop": 80rem /* ~1280px */,
"desktop": 100rem /* ~1600px */,
) !default;
```
--------------------------------
### PktCard Appearance and Layout (HTML)
Source: https://punkt.oslo.kommune.no/latest/komponenter-og-maler/komponenter/card
Illustrates how to customize the appearance (e.g., 'outlined', 'gray') and layout ('vertical', 'horizontal') of the PktCard component.
```html
```
--------------------------------
### Importing Punkt Elements Messagebox (CDN)
Source: https://punkt.oslo.kommune.no/latest/komponenter-og-maler/komponenter/messagebox
Shows how to include the Messagebox web component in an HTML file using a CDN link. This method is useful for quick implementation without a build process or package management.
```javascript
```