3.1.4 • Published 3 months ago

@highlight-ui/link v3.1.4

Weekly downloads
-
License
MIT
Repository
-
Last release
3 months ago

npm personio.design storybook.personio.design

@highlight-ui/link

Links are used for navigation, and usually appear standalone or at the end of a sentence.

Features

  • Link

    • standalone (depending on the provided href value the component will determine if the link should be external or internal and therefore either show or hide the icon)
    • inline
  • external-link icon is part of the <Link variant="standalone" /> and should be automatically shown depending on the href provided

Installation

Using npm:

npm install @highlight-ui/link

Using yarn:

yarn add @highlight-ui/link

Using pnpm:

pnpm install @highlight-ui/link

In your (S)CSS file:

@import url('@highlight-ui/link');

Once the package is installed, you can import the library:

import { Link } from '@highlight-ui/link';

Usage

standalone internal Link

import React, { useState } from 'react';
import { Link } from '@highlight-ui/link';

export default function LinkExample() {
  return <Link href="/settings">Settings</Link>;
}

standalone external Link

import React, { useState } from 'react';
import { Link } from '@highlight-ui/link';

export default function LinkExample() {
  return <Link href="http://personio.de">Personio</Link>;
}

inline Link

import React, { useState } from 'react';
import { Link } from '@highlight-ui/link';

export default function LinkExample() {
  return (
    <div>
      This is some inline text{' '}
      <Link href="/settings" variant="inline">
        this is the link
      </Link>{' '}
      this is text after the inline link
    </div>
  );
}

Props 📜

Link

All HTMLAnchorElement and PropsWithMetadata(https://gitlab.personio-internal.de/personio/platform/highlight-ui/-/blob/master/packages/utils/commons/src/types.ts#L24) props are accepted with this component. In addition to these, this component has the following props

PropTypeRequiredDefaultDescription
variant'inline', 'standalone'Nostandalonevariant of the link depending on how it is used

Accessibility ♿️

The Link component follows best practices for accessibility:

  • Uses a native <a> element to ensure proper keyboard navigation and focus handling

Testing

There are a number of unit tests covering the Link component, the snippets below can serve as a base to expand future testing if new behaviours are added.

The relevant render methods provide the option to add or override prop values.

Link

import React from 'react';
import { render } from '@testing-library/react';

import { Link, LinkProps } from '@highlight-ui/link';

describe('LinkTest', () => {
  const renderLink = (props: LinkProps) => {
    return render(<Link {...props} />);
  };

  it('test description', () => {
    renderLink({ href: '/test' });
    // write your expect here
  });
});

Place in design system 💻

The link component is an element of the design system and can be used across various services and contexts. It provides a consistent look and feel for user navigation.

Contributing 🖌️

Please visit personio.design for usage guidelines and visual examples.

If you're interested in contributing, please visit our contribution page.

3.1.4

3 months ago

3.1.3

5 months ago

3.0.12

10 months ago

3.0.13

10 months ago

3.0.10

10 months ago

3.0.11

10 months ago

3.0.16

9 months ago

3.0.17

9 months ago

3.0.14

9 months ago

3.0.15

9 months ago

3.1.0-r18.0

8 months ago

3.1.2

7 months ago

3.1.1

7 months ago

3.1.0

7 months ago

3.0.4

10 months ago

3.0.3

10 months ago

3.0.2

10 months ago

3.0.8

10 months ago

3.0.7

10 months ago

3.0.6

10 months ago

3.0.5

10 months ago

3.0.23

8 months ago

3.0.24

7 months ago

3.0.21

8 months ago

3.0.22

8 months ago

3.0.27

7 months ago

3.0.25

7 months ago

3.0.26

7 months ago

3.0.20

8 months ago

3.0.18

9 months ago

3.0.19

8 months ago

3.0.9

10 months ago

3.0.1

11 months ago

3.0.0

11 months ago

2.1.1

11 months ago

2.0.57

12 months ago

2.0.55

12 months ago

2.0.56

12 months ago

2.0.54

12 months ago

2.1.0

11 months ago

2.0.49

1 year ago

2.0.53

1 year ago

2.0.51

1 year ago

2.0.52

1 year ago

2.0.50

1 year ago

2.0.48

1 year ago

2.0.46

1 year ago

2.0.47

1 year ago

2.0.45

1 year ago

2.0.28

1 year ago

2.0.29

1 year ago

2.0.37

1 year ago

2.0.38

1 year ago

2.0.35

1 year ago

2.0.36

1 year ago

2.0.33

1 year ago

2.0.34

1 year ago

2.0.31

1 year ago

2.0.32

1 year ago

2.0.30

1 year ago

2.0.39

1 year ago

2.0.44

1 year ago

2.0.42

1 year ago

2.0.43

1 year ago

2.0.40

1 year ago

2.0.41

1 year ago

2.0.26

1 year ago

2.0.27

1 year ago

2.0.24

1 year ago

2.0.25

1 year ago

2.0.22

1 year ago

2.0.23

1 year ago

2.0.21

1 year ago

2.0.16

2 years ago

2.0.19

2 years ago

2.0.17

2 years ago

2.0.15

2 years ago

2.0.14

2 years ago

2.0.3

2 years ago

2.0.2

2 years ago

2.0.13

2 years ago

2.0.5

2 years ago

2.0.4

2 years ago

2.0.11

2 years ago

2.0.7

2 years ago

2.0.12

2 years ago

2.0.6

2 years ago

2.0.9

2 years ago

2.0.0-alpha.1

2 years ago

2.0.10

2 years ago

2.0.1

2 years ago

2.0.0

2 years ago

2.0.0-alpha.0

2 years ago

1.0.26

2 years ago

1.0.28

2 years ago

1.0.27

2 years ago

1.0.25

2 years ago

1.0.24

2 years ago

1.0.19

2 years ago

1.0.22

2 years ago

1.0.21

2 years ago

1.0.20

2 years ago

1.0.23

2 years ago

1.0.18

3 years ago

1.0.17

3 years ago

1.0.16

3 years ago

1.0.15

3 years ago

1.0.14

3 years ago

1.0.13

3 years ago

1.0.11

3 years ago

1.0.12

3 years ago

1.0.10

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago