Safe Haskell | None |
---|---|
Language | GHC2021 |
Synopsis
- button :: ViewAction (Action id) => Action id -> Mod id -> View id () -> View id ()
- dropdown :: ViewAction (Action id) => (opt -> Action id) -> (opt -> Bool) -> Mod id -> View (Option opt id (Action id)) () -> View id ()
- option :: (ViewAction (Action id), Eq opt) => opt -> View (Option opt id (Action id)) () -> View (Option opt id (Action id)) ()
- selected :: Bool -> Mod id
- data Option opt (id :: k) action = Option {}
- search :: ViewAction (Action id) => (Text -> Action id) -> DelayMs -> Mod id -> View id ()
- route :: Route a => a -> Mod c -> View c () -> View c ()
Documentation
button :: ViewAction (Action id) => Action id -> Mod id -> View id () -> View id () Source #
<button> HTML tag which sends the action when pressed
button SomeAction (border 1) "Click Me"
dropdown :: ViewAction (Action id) => (opt -> Action id) -> (opt -> Bool) -> Mod id -> View (Option opt id (Action id)) () -> View id () Source #
Type-safe dropdown. Sends (opt -> Action id) when selected. The selection predicate (opt -> Bool) controls which option is selected. See Example.Contacts
data ContactsAction = Reload (Maybe Filter) | Delete Int deriving (Generic, Param) allContactsView :: Maybe Filter -> View Contacts () allContactsView fil = do row (gap 10) $ do el (pad 10) "Filter: " dropdown Reload (== fil) id $ do option Nothing "" option (Just Active) "Active!" option (Just Inactive) "Inactive" ...
option :: (ViewAction (Action id), Eq opt) => opt -> View (Option opt id (Action id)) () -> View (Option opt id (Action id)) () Source #