Hiccup is a library for representing HTML in Clojure. It uses vectors to represent tags, and maps to represent a tag's attributes.
Questions tagged [hiccup]
90 questions
2
votes
1 answer
How to repeat a list of items from a vector in hiccup?
If I have a vector name-lst as ["John" "Mary" "Watson" "James"],
and I want to diplay them as list items, how do I do that using hiccup ?
something like
[:ul
(for [name name-list]
[:li name])]
will return a list of [:li ] in between [:ul ]…
![](../../users/profiles/961021.webp)
Amogh Talpallikar
- 11,754
- 12
- 71
- 131
2
votes
1 answer
Hiccup not working : FileNotFoundException: Could not locate ../as__init.class or ../as.clj on classpath
I'm just beginning with clojure and I'm trying to build a small web app. I wanted to try out hiccup but it doesn't seem to be working. My code is below.
Project.clj
(defproject WebTest "0.1.0-SNAPSHOT"
:description "FIXME: write description"
…
![](../../users/profiles/717666.webp)
Seth Paulson
- 770
- 6
- 14
2
votes
1 answer
Noir - unable to resolve symbol html5 in this context
I am trying to use noir and am following the tutorial that is given at the default tutorial and am using this code
(defpage "/my-page" []
(html5
[:h1 "This is my first page!"]))
However, clojure throws up an error and refuses to work.
![](../../users/profiles/1124500.webp)
logiblocs
- 58
- 5
1
vote
1 answer
Turn hiccup into html in a reagent application
This might sound a stupid question, but how do I turn a piece of hiccup into html in a ClojureScript reagent application?
I want something like this :
(html [:div [:p "hello world" ]])
that produces
This is what you…
hello world
![](../../users/profiles/8482.webp)
interstar
- 22,620
- 31
- 101
- 161
1
vote
1 answer
How to pretty print a Clojure data structure in HTML?
How to make the following code generate a similar visualization to pprint in HTML?
(let [clj-structure {:ui {:selected #{[:A 3]}}
…
![](../../users/profiles/3646180.webp)
Jp_
- 4,771
- 4
- 21
- 32
1
vote
1 answer
What is the preferred syntax for nesting a reagent hiccup element that is returned from a function?
Given a function to return an element:
(defn title []
[:h1 "Hello World"])
What is the preferred way of nesting this inside another component?
I've seen it done in a tutorial by wrapping the function call in a vector:
[:div {:class "app"}
…
![](../../users/profiles/536333.webp)
insano10
- 103
- 2
- 6
1
vote
1 answer
Why are these `select` elements not being rendered?
I'm working on a project for a client where there needs to be 125 dropdown menus displayed on one page. I of course am not going to manually add all those so I wrote a simple for expression to do it for me. This works for the vast majority of the…
![](../../users/profiles/353715.webp)
TomLisankie
- 3,221
- 5
- 26
- 30
1
vote
1 answer
How to convert the following js style map to clojurescript?
I want to write this js style map in cljs:
const pathLength = useSpring(yRange, { stiffness: 400, damping: 90 })
![](../../users/profiles/12677801.webp)
lamp bottle
- 481
- 3
- 12
1
vote
2 answers
How in Reagent with Hiccup make an element with takes all available space
I am trying to find out how in Reagent with Hiccup make an element with takes all available space. So an resize parent I will get :component-did-mount call back.
(defn chart [id col-width row-height]
(let [dimensions (atom {})]
…
user9240263
1
vote
1 answer
Building nested vector from map in Clojure
I have a set of URLs, and some of the URLs have indirect references (as a vector). Any URL that does not have an indirect reference just has nil. I'm starting out with the following test map:
{"URL 1" nil,
"URL 2" ["indirect 1" "indirect 2"]}
I'm…
![](../../users/profiles/5436777.webp)
R Jackson
- 105
- 2
- 13
1
vote
0 answers
Clojure file upload with hiccup, ring, compojure
I am trying to create file upload system. However, i stuck and can't resolve the problem.
My core.cjl
(ns hiccup-templating.core
(:require [compojure.core :refer [defroutes GET ANY POST]]
[compojure.route :as route]
…
![](../../users/profiles/7241891.webp)
Andrei Belkevich
- 73
- 6
1
vote
1 answer
Clojure form - Submit when press enter
I have a search-form that searches some text for me. When I type in the input box I have to manually press a button for it to search. Is there a way for me to hit enter on the keyboard and have that search, as well as the button?
(defn search-form
…
![](../../users/profiles/5143940.webp)
rbb
- 919
- 6
- 14
1
vote
1 answer
Recursion in html like data structure using clojure
I have been thinking about this problem, but I can't figure out the steps to build my function:
I have an hiccup like html data as input, this structure is composed by html and custom elements, example:
format: [tag-name options & body]
[:a {} []]…
![](../../users/profiles/2068014.webp)
Mateus Vahl
- 889
- 2
- 11
- 25
1
vote
3 answers
Clojure: Proper condp Usage
I'm rewriting my History of the World website (history.clmitchell.net) in clojure and making great progress. I've reached the point where I need to use a conditional to output hiccup code for declaring CSS links based on which page I'm loading. I've…
![](../../users/profiles/1894945.webp)
Quasaur
- 1,177
- 1
- 9
- 27
1
vote
1 answer
How can I script math functionality in Clojure using Hiccup and Compojure?
I have a home page being rendered that requests user-input as vectors of integers. I need those data-structures, because they play nice with the math functions that I will use to manipulate the input:
(defn home [& [weights grades error]]
(html
…
![](../../users/profiles/3000857.webp)
kurofune
- 1,025
- 11
- 22