
Security News
rv Is a New Rust-Powered Ruby Version Manager Inspired by Python's uv
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
@codegouvfr/rescript-react-dsfr
Advanced tools
rescript-react-dsfr
Report Bug
•
react-dsfr
•
Components API
🇫🇷 ReScript bindings for the
react-dsfr
TS library.
[!IMPORTANT] This project has only been tested for the needs of the
catala-dsfr
project.
yarn add @codegouvfr/rescript-react-dsfr
Then add it to bsconfig.json
:
"bs-dependencies": [
+ "@codegouvfr/rescript-react-dsfr"
]
[!TIP] You can look a the demo web app or at a real-world example in the
catala-dsfr
repository.
DSFR.Spa.startReactDsfr({
defaultColorScheme: #system,
link: Link.make,
useLang: () => #fr,
})
The API should be straightforward to use as it try to match as closely as
possible the original API. At the difference that constants strings are
replaced by polymorphic variants and that reserved keywords in ReScript like
type
or as
are suffixed with an _
(e.g. type_
or as_
).
For example, for the Badge
component:
// In a .tsx file
import { Badge } from '@codegouvfr/react-dsfr/badge'
let button = (
<Badge type="info" as="span" noIcon={true} severity="new">
Nouveau
</Badge>
)
open DSFR
// In a .res file
let button = (
<Badge type=#info as_=#span noIcon=true severity=#new>
{React.string("Nouveau")}
</Badge>
)
cx
functionThe DSFR.Fr.cx
function is used to generate class names from an array of
variants. It allows to type check the class names and provides suggestions
from you IDE.
open DSFR
let e =
<div className={Fr.cx([#"fr-grid-row", #"fr-grid-row--center"])}>
//...
</div>
Polymorphic variants for class names ./src/DSFR__ClassNames.res
(such as
icon's id or color variants) are generated from the @codegouvfr/react-dsfr
source code. To update them, run:
yarn generate-classNames
# or it will be run automatically when installing the package
yarn
[!IMPORTANT] This script is run with
bun
and it can be installed withyarn
so you need to install it manually if you don't have it
[!WARNING] Bindings are created by hand, looking at the storybook. Therefore, a minima all the API described in the storybook should be available but it is possible that some props are missing or that some props are not typed correctly.
Do not hesitate to open an issue or a PR if you find something.
✅ Implemented | ❌ Not implemented | 🚧 In progress
Component | Status |
---|---|
Accordion | ✅ |
AgentConnectButton | ✅ |
Alert | ✅ |
Badge | ✅ |
Breadcrumb | ✅ |
Button | ✅ |
ButtonsGroup | ✅ |
Callout | ✅ |
Card | ✅ |
Checkbox | ❌ |
consentManagement | ❌ |
Display | ✅ |
Download | ❌ |
Footer | ✅ |
FranceConnectButton | ✅ |
Header | ✅ |
Highlight | ❌ |
Input | ❌ |
MainNavigation | ❌ |
Modal | ❌ |
MonCompteProButton | ✅ |
Notice | ✅ |
Pagination | ❌ |
PasswordInput | ❌ |
Quote | ❌ |
RadioButtons | ❌ |
SearchBar | ❌ |
Select | ❌ |
SelectNext | ❌ |
SlideMenu | ❌ |
Stepper | ❌ |
Table | ❌ |
Tabs | ❌ |
Tag | ❌ |
Tile | ❌ |
ToggleSwitch | ❌ |
ToggleSwitchGroup | ❌ |
Upload | ❌ |
FAQs
ReScript bindings for react-dsfr
The npm package @codegouvfr/rescript-react-dsfr receives a total of 3 weekly downloads. As such, @codegouvfr/rescript-react-dsfr popularity was classified as not popular.
We found that @codegouvfr/rescript-react-dsfr demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers collaborating on the project.
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.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.
Security News
AGENTS.md is a fast-growing open format giving AI coding agents a shared, predictable way to understand project setup, style, and workflows.