Fable.PopperJS.React
1.0.0
dotnet add package Fable.PopperJS.React --version 1.0.0
NuGet\Install-Package Fable.PopperJS.React -Version 1.0.0
<PackageReference Include="Fable.PopperJS.React" Version="1.0.0" />
paket add Fable.PopperJS.React --version 1.0.0
#r "nuget: Fable.PopperJS.React, 1.0.0"
// Install Fable.PopperJS.React as a Cake Addin #addin nuget:?package=Fable.PopperJS.React&version=1.0.0 // Install Fable.PopperJS.React as a Cake Tool #tool nuget:?package=Fable.PopperJS.React&version=1.0.0
Fable.PopperJS & Fable.PopperJS.React
Fable binding for Tooltip & Popover Positioning Engine PopperJS.
and
Installation Using Femto
Using Femto you can install the library and its npm dependency in one go:
femto install Fable.PopperJS
or for React version:
femto install Fable.PopperJS.React
Installation
Install the binding from Nuget via paket
paket add Fable.PopperJS --project path/to/Proj.fsproj
Install the actual Javascript library @popperjs/core
from npm
npm install @popperjs/core@2.11.2
For React version
npm install @popperjs/core@2.11.2
npm install react-popper@2.2.5
Usage
Via plain JS objects (https://codesandbox.io/s/github/popperjs/website/tree/master/examples/placement):
open Browser.Types
open Browser.Dom
open Fable.Core.JsInterop
open PopperJsCore.Enums
open PopperJsCore.CreatePopper
let popcorn = document.querySelector("#popcorn")
let tooltip = document.querySelector("#tooltip") :?> HTMLElement
let settingsjs = createObj [
"placement" ==> "bottom"
"modifiers" ==> [|
createObj [
"name" ==> "offset"
"options" ==> createObj [
"offset" ==> [|0;8|]
]
]
|]
]
createPopper(popcorn,tooltip,settingsjs) |> ignore
Via strongly-typed F# DSL:
open Browser.Types
open Browser.Dom
open Fable.Core.JsInterop
open PopperJsCore.Enums
open PopperJsCore.CreatePopper
let popcorn = document.querySelector("#popcorn")
let tooltip = document.querySelector("#tooltip") :?> HTMLElement
let settings = PopperOptions()
.withPlacement(Placement.Case2 BasePlacement.Right)
.withAddedModifier(PopperModifier()
.withName("offset")
.withOptions(createObj [ "offset" ==> [0;8] ])
)
.Finalize()
Popper.createPopper(popcorn, tooltip, settings) |> ignore
Fable.PopperJS.React as a React Hook (https://popper.js.org/react-popper/v2/#example):
open Browser.Types
open Feliz
open Browser.Dom
open Fable.Core.JsInterop
open PopperJsCore.Enums
open PopperJsCore.CreatePopper
open Fable.PopperJS.React
open Fable.Core.JS
[<ReactComponent>]
let Example() =
let (referenceElement: Element, setReferenceElement) = React.useState(null)
let (popperElement: Element, setPopperElement) = React.useState(null)
let (arrowElement: Element, setArrowElement) = React.useState(null)
let options = PopperOptions()
.withAddedModifier(PopperModifier()
.withName("arrow")
.withOptions(createObj ["element" ==> arrowElement])
)
.Finalize()
let ret = React.usePopper(Fable.Core.Case1 referenceElement, popperElement :?> HTMLElement, options :?> usePopperOptions)
Html.div [
prop.style [style.paddingTop 50]
prop.children[
Html.button [
prop.type' "button"
prop.ref setReferenceElement
prop.text "Reference element"
]
Html.div[
prop.ref setPopperElement
prop.custom("style",ret.styles.popper)
if ret.attributes.popper.IsSome then
for (key,value) in Constructors.Object.entries ret.attributes.popper.Value do
prop.custom(key,value)
prop.children [
Html.text "Popper element"
Html.div [
prop.ref setArrowElement
prop.custom("style",ret.styles.arrow)
]
]
]
]
]
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Fable.Browser.DOM (>= 2.9.0)
- Fable.Core (>= 3.6.1)
- Fable.PopperJS (>= 1.0.0)
- Feliz (>= 1.58.1)
- FSharp.Core (>= 6.0.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.0.0 | 321 | 2/19/2022 |