
Research
Security News
The Growing Risk of Malicious Browser Extensions
Socket researchers uncover how browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.
@slice-and-dice/govuk-react-top-nav
Advanced tools
Styled top navigation header with numerous constituent parts input as props.
import TopNav from '@govuk-react/top-nav';
TopNav with logo, service title and navigation items
import CrownIcon from '@govuk-react/icon-crown';
import SearchBox from '@govuk-react/search-box';
import TopNav, { asNavLinkAnchor, asTopNavAnchor } from '@govuk-react/top-nav';
const LogoAnchor = asTopNavAnchor('a');
const NavAnchor = asNavLinkAnchor('a');
const link = 'https://example.com?=1';
const Company = (
<LogoAnchor href={link} target="new">
<TopNav.IconTitle icon={<CrownIcon width="36" height="32" />}>GOV.UK</TopNav.IconTitle>
</LogoAnchor>
);
const ServiceTitle = (
<NavAnchor href={link} target="new">
Service Title
</NavAnchor>
);
const Search = (
<SearchBox placeholder="Search">hi</SearchBox>
);
<TopNav company={Company} serviceTitle={ServiceTitle} search={Search} active={0}>
<NavAnchor href="https://example.com?q=catdog" target="new">Navigation item #1</NavAnchor>
<NavAnchor href="https://example.com?q=dogcat" target="new">Navigation item #2</NavAnchor>
</TopNav>
import { BrowserRouter, Link } from 'react-router-dom';
import CrownIcon from '@govuk-react/icon-crown';
import TopNav, { asLogoAnchor, asNavLinkAnchor } from '@govuk-react/top-nav';
const LogoLink = asTopNavAnchor(Link);
const NavLink= asNavLinkAnchor(Link);
const reactRouterLink = '/section';
const CompanyLink = (
<LogoLink to={reactRouterLink}>
<TopNav.IconTitle icon={<CrownIcon width="36" height="32" />}>GOV.UK</TopNav.IconTitle>
</LogoLink>
);
const ServiceTitleLink = (
<NavLink to={reactRouterLink}>
Service Title
</NavLink>
);
<BrowserRouter>
<TopNav company={CompanyLink} serviceTitle={ServiceTitleLink} />
</BrowserRouter>
active
navigation itemsProp | Required | Default | Type | Description |
---|---|---|---|---|
bgColor | BLACK | string | Top nav background color | |
children | undefined | node | List Navigation items with anchor tags e.g. NavAnchor components | |
color | WHITE | string | Top nav text color | |
company | <IconTitle icon={<CrownIcon width="36" height="32" />}>GOV.UK</IconTitle> | node | Company component e.g. GOV UK | |
defaultOpen | false | bool | Is the mobile navigation open by default? | |
search | false | node | Search component | |
serviceTitle | undefined | node | Service title component e.g. Food Standards Authority |
FAQs
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover how browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.
Research
Security News
An in-depth analysis of credential stealers, crypto drainers, cryptojackers, and clipboard hijackers abusing open source package registries to compromise Web3 development environments.
Security News
pnpm 10.12.1 introduces a global virtual store for faster installs and new options for managing dependencies with version catalogs.